moment / luxon

⏱ A library for working with dates and times in JS
https://moment.github.io/luxon
MIT License
15.32k stars 730 forks source link

Return Invalid DateTime for using meridiem with 24-hour (#1549) #1562

Open Matthematic opened 9 months ago

Matthematic commented 9 months ago

This is a fix for the case where the input '11-08-2023 15:00 AM' is parsed and interpreted as '11-08-2023 03:00 PM'. Instead of this, it should be a Datetime.Invalid with a "unit out of range" reason similar to what happens with '11-08-2023 25:00'.

fixes #1549

linux-foundation-easycla[bot] commented 9 months ago

CLA Signed

The committers listed above are authorized under a signed CLA.

icambron commented 2 months ago

Sorry for the long delay in reviewing this.

While I agree this is a bug, it's a minor one, and the fix is unfortunate, because it's extra work on the hot path. I think if you can use the benchmarks not mearningfully shower that token parsing is no slower now, we can merge this.