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

Parsing plain year numbers like "2024" with "PREFER..."-settings set to "last" returns wrong date. 1 day missing... #1228

Open
Zeutschler opened this issue Jun 9, 2024 · 1 comment

Comments

@Zeutschler
Copy link

print(dateparser.parse(
date_string="2024",
settings={"STRICT_PARSING": False,
"PREFER_DAY_OF_MONTH": "last",
"PREFER_MONTH_OF_YEAR": "last",
"PREFER_DATES_FROM": "past"}))
2024-12-30 00:00:00

It seems you're skipping a day. It should be 2024-12-31 00:00:00

...running on Macbook Air M2, Python 3.11 with

import locale
print(locale.getlocale())
(None, 'UTF-8')

@gguimezanes
Copy link

Same problem here on windows, using only
settings={
"PREFER_DAY_OF_MONTH": "last",
"PREFER_MONTH_OF_YEAR": "last"
}

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

2 participants