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

Detects datetime.datetime(2015, 12, 18, 0, 0) when given " 2015 " #197

Open
Uettwillera opened this issue Dec 18, 2023 · 2 comments
Open

Comments

@Uettwillera
Copy link

Uettwillera commented Dec 18, 2023

When sending " 2015 " it returns December 18th, 2015.

> [x for x in datefinder.find_dates(" 2015 ")]
[datetime.datetime(2015, 12, 18, 0, 0)]
@Uettwillera
Copy link
Author

Similar issue with any number really:

[x for x in datefinder.find_dates(" 7 ")]
returns December 7th, 2023

@whywouldyoumakemechooseausername
Copy link

whywouldyoumakemechooseausername commented Mar 16, 2024

datefinder.find_dates() uses dateutil.parser.parse(), which returns a base date (by default: the current date), overwritten with parsed information.

Default output will always be data you provided + the current date (unless specified otherwise).
This is undocumented behaviour, the base_date parameter for datefinder.find_dates(), which can be used to overwrite the base_date, however, is.

It may be a good idea to add not only the type of object it returns, but also a few words about its specific contents within the documentation.

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