dateparser icon indicating copy to clipboard operation
dateparser copied to clipboard

1st - 12th treated as months rather than days

Open EtorixDev opened this issue 2 years ago • 0 comments

Using the common date abbreviations of Date + st, nd, rd, th alone returns months for 1st - 12th rather than days.

Example of current behavior (desired) with 13th - 31st

dateparser.parse("13th")
dateparser.parse("25th 5pm")
> 2023-01-13 00:00:00
> 2023-01-25 17:00:00

Example of current behavior (unwanted) with 1st - 12th

dateparser.parse("2nd 9pm")
dateparser.parse("12th 11am")
> 2023-02-09 21:00:00
> 2023-12-09 11:00:00

Example of desired behavior with 1st - 12th

dateparser.parse("2nd 9pm")
dateparser.parse("12th 11am")
> 2023-01-02 21:00:00
> 2023-01-12 11:00:00

I'm aware this may be avoided by passing a DATE_ORDER option through the settings, but that would break other functionality when the default order of MDY is desired. And the use of the date abbreviations specified above are very common even with MDY, so some sort of solution to allow both would be ideal.

EtorixDev avatar Jan 09 '23 10:01 EtorixDev