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

Can it determine distance from a static date? #33

Open
jwnacnud opened this issue Jan 30, 2023 · 4 comments
Open

Can it determine distance from a static date? #33

jwnacnud opened this issue Jan 30, 2023 · 4 comments

Comments

@jwnacnud
Copy link

For example, if I have a static value, such as my birthday, could I enter something like "halfway through my 18th year"? Thus the distance would be birth_date + 18 years.

@olebedev
Copy link
Owner

Hey @jwnacnud, thanks for the question.

Not really, because it doesn't return time.Duration but time.Time.

@olebedev
Copy link
Owner

In order to infer the point in time, the static date should also be present in the parser's context, right? Like,

My BDay is on 12/09/1980 and I am halfway through my 18th year

Otherwise, you would need to return time.Duration from the parser and apply it later on. The latter, is not really possible as I mentioned above. However, the former can be done with a planned merge strategy. But it's not implemented yet. Please feel free to propose a solution for that!

Best regards,
Oleg

@olebedev
Copy link
Owner

olebedev commented Jun 1, 2023

In addition to the above, checked the code once again, I think we can add Duration to the Result object here so after that you will be able to create rules that capture durations like you mention.

@jwnacnud
Copy link
Author

jwnacnud commented Jun 4, 2023 via email

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