scrapinghub / dateparser

python parser for human readable dates
BSD 3-Clause "New" or "Revised" License
2.55k stars 465 forks source link

"First of this month" becomes January #947

Closed robertocarta closed 3 years ago

robertocarta commented 3 years ago

Hi, I noticed that anything in the form of "x of this month" returns current datetime:

datetime.datetime(2021, 7, 22, 14, 48, 14, 688482)
>>> dateparser.parse("1st of this month")
datetime.datetime(2021, 7, 22, 14, 48, 24, 709477)
>>>

However, even more puzzling:

>>> dateparser.parse("20th")
datetime.datetime(2021, 7, 20, 0, 0)
>>> dateparser.parse("1st")
datetime.datetime(2021, 1, 22, 0, 0)
>>>
noviluni commented 3 years ago

Hi @robertocarta, dateparser currenly doesn't support ordinals like 1st, first or 20th. However, it's planned.

We built the number-parser with this goal, but it has not yet been integrated.

Gallaecio commented 3 years ago

Shall we close this in favor of https://github.com/scrapinghub/dateparser/issues/651 ?

noviluni commented 3 years ago

Hi @Gallaecio, I will close this in favor of that issue. Thanks!