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

'last year' vs 'last 5 years' #227

Open
carlomazzaferro opened this issue Apr 5, 2018 · 2 comments
Open

'last year' vs 'last 5 years' #227

carlomazzaferro opened this issue Apr 5, 2018 · 2 comments

Comments

@carlomazzaferro
Copy link

In brief:

>>> time_struct, parse_status = cal.parse("last fiscal year")
>>> datetime(*time_struct[:6])
datetime.datetime(2018, 4, 5, 13, 46, 25)
>>> time_struct, parse_status = cal.parse("last 5 years")  # same result for 'past 5 years'
>>> datetime(*time_struct[:6])
datetime.datetime(2023, 4, 5, 13, 46, 29)

Is this the default/correct behavior? At least logically it makes little sense to me to get a future date for a some a string that is clearly referencing the past. Maybe someone with a better understanding of the internals of the library can chime in?

Thanks in advance!

@carlomazzaferro carlomazzaferro changed the title last year vs last 5 years 'last year' vs 'last 5 years' Apr 5, 2018
@idpaterson
Copy link
Collaborator

What output would you expect for that, it seems like it would have to be 5 dates for each of the last 5 years? Since that construct is not supported it is just identifying the "5 years" portion and ignoring "last". The nlp function is useful for determining how a string is parsed since it includes the substring that matched.

@carlomazzaferro
Copy link
Author

I see. Ideally, I'd get a daterange or timedelta. At first I thought that was supported but I didn't look well enough through the docs. Is it something that is aimed to be supported at all in the future?

Thanks for the pointer, I'll look through the code .

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