when
when copied to clipboard
Add option to return prior dates if ambiguous
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.
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 on: trigger. I've used/seen it as:
on:
push:
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.