-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intl.DateTimeFormat.prototype.format outputs a string with a unicode <space> instead of an ASCII <space> #45938
Comments
Related ticket/comment: #45171 (comment) It's not obvious to me what's wrong with the newer behavior, though. |
This was fixed in v19.2.0, V8's date parser now recognizes U+202F. edit: I assume the |
I'm testing it on v19.2.0 and I'm still getting the issue.
Maybe, but it's not intuitive why it doesn't work? Given other examples: // in v19.2.0 using `output` from the original example ("8:00 AM")
/ /.test(output); // false
/\u202F/.test(output); // true
/\u0041/.test(output); // true (the letter 'A')
/A/.test(output); // true I guess I would have thought One weird thing about this behavior is that it deviates from how the browser does it? The most up-to-date Chrome, Firefox, and Safari all allow My real-world use case is that in our app we styleize the times as |
Why?
The question is less your V8 version and more the ICU version that’s being shipped. Chrome has also upgrade to ICU 72.1 now so I’d expect at some point they’ll adapt the same behavior.
As Ben says, programmatically relying on localized date formats is tricky, and you may not want to be using |
Chrome Canary (at least) updated to ICU 72.1 and shows the same behavior as Node.js 19 |
I'm quite out of my depth here. 😅 I guess I assumed that the characters I type into a string were ASCII and then maybe mapped to their unicode counterparts or something? But that wouldn't make sense since I can paste unicode characters into strings... For me it was just frustrating that there are multiple space characters and the one that I type in with my space bar is not the same that is output from Thanks for walking me through this, I'll update our code to rip out whitespace rather than just a space! |
Version
v19.1.0
Platform
Darwin 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:14:54 PDT 2022; root:xnu-8792.41.9~2/RELEASE_X86_64 x86_64
Subsystem
No response
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Every time as far as I can tell
What is the expected behavior?
What do you see instead?
Additional information
No response
The text was updated successfully, but these errors were encountered: