Why does a call to dateutil.parser.parse indicate november is december?

77 views Asked by At

If I run the following:

from dateutil import parser
parser.parse("Wind10_463@Y2014_M11_D19", fuzzy=True)

I get this:

datetime.datetime(2014, 12, 19, 0, 0)

Why is it saying December not November?

1

There are 1 answers

4
Ffisegydd On BEST ANSWER

It's not able to fully parse the structure of your string. When dateutil.parser.parse is missing one of the fields, such as the month, it will fill it in with the current month, which is December.

From the docs:

default: If given, this must be a datetime instance. Any fields missing in the parsed date will be copied from > this instance. The default value is the current date, at 00:00:00am.