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

Add option to return prior dates if ambiguous #35

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

mvgrimes
Copy link

In situations where the year is ambiguous (ie, 6/20 or May 12th) the package
seems to prefer to return a future date. In some situations, I think it will
default to the current year. This patch adds WantPast to the rules.Option.
When this is true it will return the prior instance of that date. It defaults
to false which preserve the current functionality.

Some examples, assuming today is July 15, 2016:

DD/MM WantPast=False WantPast=True
14/07 2017-07-14 2016-07-14
15/07 2016-07-15 2016-07-15
16/07 2016-07-16 2015-07-16

There are several strategies that could be used here: WantPast, WantFuture,
Closest, ... I've only implemented WantPast, but if there was interest then
maybe converting WantPast to an enum would make more sense.

@olebedev
Copy link
Owner

Hi @mvgrimes, thank you for the contribution! I will get back to you once I have some time to review the change.

In the meantime, do you know why the github actions haven't been triggered oner the change?

@mvgrimes
Copy link
Author

I don't have much experience with github actions, but I wonder if it is the on: trigger. I've used/seen it as:

on:
   push:

@olebedev
Copy link
Owner

Oh, I think I found the issue, we would need to have trigger on the pull_request as well. I'll give it a try when I have time, but feel free to add it in your PR or please add an empty commit so we can see the tests passed.

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

Successfully merging this pull request may close these issues.

2 participants