dateparser icon indicating copy to clipboard operation
dateparser copied to clipboard

DeprecationWarning: Parsing dates involving a day of month without a year specified is ambiguious

Open wimglenn opened this issue 1 year ago • 1 comments

dateparser 1.2.0 on Python 3.13 / Linux:

$ python3 -q -Wall
>>> from dateparser import parse
>>> parse("2024-11-27")
.../lib/python3.13/site-packages/dateparser/utils/strptime.py:94: DeprecationWarning: Parsing dates involving a day of month without a year specified is ambiguious
and fails to parse leap day. The default behavior will change in Python 3.15
to either always raise an exception or to use a different default year (TBD).
To avoid trouble, add a specific year to the input & format.
See https://github.com/python/cpython/issues/70647.
  obj = datetime(*__strptime(date_string, format)[:-3])
.../lib/python3.13/site-packages/dateparser/utils/strptime.py:94: DeprecationWarning: Parsing dates involving a day of month without a year specified is ambiguious
and fails to parse leap day. The default behavior will change in Python 3.15
to either always raise an exception or to use a different default year (TBD).
To avoid trouble, add a specific year to the input & format.
See https://github.com/python/cpython/issues/70647.
  obj = datetime(*__strptime(date_string, format)[:-3])
datetime.datetime(2024, 11, 27, 0, 0)

wimglenn avatar Nov 27 '24 21:11 wimglenn

I came here looking for a solution to this, but it still hasn't been merged unfortunately.

v8oholic avatar Apr 01 '25 10:04 v8oholic

Can anyone check that https://github.com/scrapinghub/dateparser/pull/1288 works for you?

Gallaecio avatar Oct 27 '25 12:10 Gallaecio

Can anyone check that #1288 works for you?

Works for me 👍

BoboTiG avatar Oct 27 '25 16:10 BoboTiG