-
Notifications
You must be signed in to change notification settings - Fork 742
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
Fix support for Node.js 18.13+ #1369
Conversation
This started affecting our customers that use Chrome/Edge. Any chance we can expedite this review? |
I don't think this should be done always, it should be opt-in. An option like |
Some clarification of the above:
|
The docs actually say |
Correct, and so it does. But the localized output in this case contains a narrow width space, not a normal space. As such a normal space does not fit the format. This change makes parsing more lax, allowing any whitespace in place of where the localized time says a narrow width space should be.
|
To clarify: const dt = DateTime.now();
const roundtrip = DateTime.fromFormat(dt.toLocaleString(DateTime.TIME_SIMPLE), 't'); This always works. |
It still is a regular space in certain runtimes. Localized time is by definition lax. If one needs strict parsing they should use explicit tokens. Otherwise, the |
I'm sorry. I think I was running down a path of "but the docs say so, so it must be done this way". One change I would suggest though is to make the regex not accept new lines, i.e. use
|
Another note, I am not a fan of how special-cased this implementation is. I think it would be better, to handle the white-space normalization similar to how it is already done for the other parsing code in |
Change white-space tolerance to only accept non-breaking white-space
Thank you for your contribution @mohd-akram and sorry for the back and forth. |
It seems Node and the browsers are reverting the breaking change, but now at least Luxon is compatible either way 😄 |
**Changelog** **3.4.2 (2023-08-26)** - Fixes regression from 3.4.1 (moment/luxon#1493) **3.4.1 (2023-08-23)** - Fixes for regressions from 3.4.0 (moment/luxon#1482 and moment/luxon#1488) **3.4.0 (2023-08-08)** - Fix type checking on input zones - Fix Islamic months listing - Fix normalize() for negative inputs **3.3.0 (2023-03-03)** - Fix off-by-one in Interval#count (moment/luxon#1308) - Support formatting for custom zones (moment/luxon#1377) - Fix parsing for narrow spaces (moment/luxon#1369) - Handle leap year issue with AD 100 (moment/luxon#1390) - Allow parsing of just an offset **3.2.1 (2023-01-04)** - Fix for RFC-2822 regex vulnerability - Better handling of BCP tags with -x- extensions **3.2.0 (2022-12-29)** - Allow timeZone to be specified as an intl option - Fix for diff's handling of end-of-month when crossing leap years (moment/luxon#1340) - Add Interval.toLocaleString() (moment/luxon#1320) **3.1.1 (2022-11-28)** - Add Settings.twoDigitCutoffYear **3.1.0 (2022-10-31)** - Add Duration.rescale **3.0.4 (2022-09-24)** - Fix quarters in diffs (moment/luxon#1279) - Export package.json in package (moment/luxon#1239) **3.0.2 (2022-08-28)** - Lots of doc changes - Added DateTime.expandFormat - Added support for custom conversion matrices in Durations
**Changelog** **3.4.2 (2023-08-26)** - Fixes regression from 3.4.1 (moment/luxon#1493) **3.4.1 (2023-08-23)** - Fixes for regressions from 3.4.0 (moment/luxon#1482 and moment/luxon#1488) **3.4.0 (2023-08-08)** - Fix type checking on input zones - Fix Islamic months listing - Fix normalize() for negative inputs **3.3.0 (2023-03-03)** - Fix off-by-one in Interval#count (moment/luxon#1308) - Support formatting for custom zones (moment/luxon#1377) - Fix parsing for narrow spaces (moment/luxon#1369) - Handle leap year issue with AD 100 (moment/luxon#1390) - Allow parsing of just an offset **3.2.1 (2023-01-04)** - Fix for RFC-2822 regex vulnerability - Better handling of BCP tags with -x- extensions **3.2.0 (2022-12-29)** - Allow timeZone to be specified as an intl option - Fix for diff's handling of end-of-month when crossing leap years (moment/luxon#1340) - Add Interval.toLocaleString() (moment/luxon#1320) **3.1.1 (2022-11-28)** - Add Settings.twoDigitCutoffYear **3.1.0 (2022-10-31)** - Add Duration.rescale **3.0.4 (2022-09-24)** - Fix quarters in diffs (moment/luxon#1279) - Export package.json in package (moment/luxon#1239) **3.0.2 (2022-08-28)** - Lots of doc changes - Added DateTime.expandFormat - Added support for custom conversion matrices in Durations closes #133599 Related: odoo/enterprise#46556 Signed-off-by: Luca Vitali (luvi) <[email protected]>
Would it be possible to backport this fix for luxon 1.x as well? |
@ranjan-purbey no, pretty much not going to make Luxon 1.0 fixes. Note that upgrading is not usually very involved, so I encourage you to do that instead. |
Fixes #1364