Closed
Description
Details
The space character immediately preceding "AM"/"PM" in the return value is a Unicode "NARROW NO-BREAK SPACE" (8239) character, instead of the correct "SPACE" (32) character.
Affects Date.prototype.toLocaleTimeString
and Date.prototype.toLocaleString
.
Node.js version
v18.13.0
Example code
let localeString = new Date().toLocaleString(); // e.g., "1/6/2023, 2:10:22 PM"
let lastThreeChars = localeString.slice(-3); // e.g., " PM"
lastThreeChars.charCodeAt(0); // 8239 (but should be 32)
Operating system
macOS 12.5.1 (21G83)
Scope
Runtime
Module and version
Not applicable.
Metadata
Metadata
Assignees
Labels
No labels