-
Notifications
You must be signed in to change notification settings - Fork 82
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
base: master
Are you sure you want to change the base?
Conversation
If no year is specified, then nil is returned for: - current date July 15 in test - future months
The OFFSET based tests probably make it easier for things like "yesterday at 10am", but for DMY or MDY it is much simpler to compare it to a time.Time.
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? |
I don't have much experience with github actions, but I wonder if it is the
|
Oh, I think I found the issue, we would need to have trigger on the |
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:
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.