-
Notifications
You must be signed in to change notification settings - Fork 728
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
Unable to parse a luxon's formatted DateTime with a locale having a different numbering system #1120
Comments
@brboi I am experiencing the same issue with arabic I added the following tests to the luxon tokenParse.test.js
I get this output And testing the 24 hour format with this test
I get this output |
Yeah, this is a general problem with other character sets; they don't match the |
The mechanism for this is already present and was added in 2019. But it only works if you specify the numbering system manually, it is not inferred from the locale. That would be easy to add though. const locale = 'ar-001';
const dt = DateTime.fromISO('2014-08-06T13:07:04.054');
const formatted = dt.toFormat("dd MMM, yyyy hh:mm:ss", {locale: locale});
const localeOptions = new Intl.DateTimeFormat(locale).resolvedOptions();
const reverse = DateTime.fromFormat(formatted, "dd MMM, yyyy hh:mm:ss", {locale: locale, numberingSystem: localeOptions.numberingSystem}); |
Describe the bug
Unable to parse a luxon's formatted DateTime with a locale having a different numbering system
To Reproduce
A minimal code example that triggers the problem:
fromFormatExplain
gives us the following object where we could clearly see that the regex would never match as the numbering system is not the same as the\d
regexp token:Actual vs Expected behavior
Actual:
Expected:
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: