when
when copied to clipboard
Support for the US date format: 04/27/2019
- [x] SlashMDY
Fix: Common US dates not working. #10
Hey @gbaptista,
Thanks for your contribution.
The main concern about this PR is that even real human cannot say for 100% sure which format is used for, say, 03/04/2019
. That's why the problem has no simple solution.
The most obvious approach could be based on timezone. What exactly dateparse does.
Any thoughts with regard to the problem solution are very welcome.
/cc @orsinium, @JamesHaskell
What about adding the rule, but not making it active by default. Then the user of the library can select which format they want. I've added SlashMDY in rules/common
then in the calling program:
w := when.New(nil)
w.Add(en.All...)
w.Add(common.SlashMDY(rules.Override))
I put it in the rules/common
package since that was where the SlashDMY rule was. The key is just not to include it in en.All
.
I've implement this is here
@mvgrimes, I like the idea of having more non-default rules available to cover common edge-cases, as this would save people time from having to create them themselves. However, it would be important to make it clear which rules are default and which are not, to avoid confusion.