Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong parsing - june 15,1987 to datetime.datetime(2023, 6, 15, 0, 0) #1321

Open
FluffyDietEngine opened this issue Nov 17, 2023 · 0 comments

Comments

@FluffyDietEngine
Copy link

While trying to parse the date june 15,1987, the year is getting parsed as current year instead of any year been given in this format. But adding a space after comma fixes it.

>>> from dateutil.parser import parse as du_parse
>>> dt = "june 15,1987"
>>> du_parse(dt)
datetime.datetime(2023, 6, 15, 0, 0) # wrong output
>>> dt = "june 15, 1987"
>>> du_parse(dt)
datetime.datetime(1987, 6, 15, 0, 0)# correct one

This is creating impact in dependant library, Maya as well.

>>> from maya import parse
>>> parse(dt)
<MayaDT epoch=550713600.0>
>>> parse(dt).datetime()
datetime.datetime(1987, 6, 15, 0, 0, tzinfo=<UTC>)
>>> dt = "june 15,1987"
>>> parse(dt).datetime()
datetime.datetime(2023, 6, 15, 0, 0, tzinfo=<UTC>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant