Skip to content
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

DateFormat.jm().parse() failing on String that previously worked. #637

Closed
jonbhanson opened this issue Apr 20, 2023 · 4 comments
Closed

Comments

@jonbhanson
Copy link

jonbhanson commented Apr 20, 2023

Previously, DateFormat.jm().parse("12:30 PM") worked fine. However, in version 0.18.1 of intl, this now throws a FormatException. The reason is because "12:30 PM" has a space between the time and the PM, and intl is comparing this space against the space in the jm pattern. This commit changed the space character in the jm pattern to a Narrow No-Break Space so the equality check is now false, triggering the FormatException.

@jonbhanson jonbhanson changed the title DateFormat.jm().parse() failing on time that previously worked. DateFormat.jm().parse() failing on String that previously worked. Apr 20, 2023
@mosuem
Copy link
Member

mosuem commented Apr 24, 2023

Thanks for filing this issue! However, this is working as intended, as the CLDR data underlying this change indeed changed the space as you described.

@mosuem mosuem closed this as not planned Won't fix, can't repro, duplicate, stale Apr 24, 2023
@jonbhanson
Copy link
Author

jonbhanson commented Apr 24, 2023

If that is the case, this update should have incremented the major version number because this is a breaking change.

@rurickdev
Copy link

Agree this break a lot of test for me, also this change is in not listed in the changelog of the package, also, not knowing which space character is used is complicated to do tests and manually put that special character, even vscode highlights it like, I think think this is not a user friendly change (dev ux wise) .

For others our team changed the jms() methods to h:mm:ss a string in our formatter class

@mosuem
Copy link
Member

mosuem commented May 4, 2023

See also this discussion in NodeJS - changes to formatting are not breaking as they are intended for humans, not machines.

@jonbhanson Major version releases indicate changes in the API - the actual behavior of the formatting is updated regularly as part of the CLDR releases. I agree that this should have been communicated more clearly though.

@rurickdev You are right about the missing changelog entry, thank you for pointing that out. I filed #641 to address this. The white space change was decided on in a long process by language experts and is rolled out to all languages, not just Dart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants