when icon indicating copy to clipboard operation
when copied to clipboard

Support for the US date format: 04/27/2019

Open gbaptista opened this issue 5 years ago • 4 comments

  • [x] SlashMDY

Fix: Common US dates not working. #10

gbaptista avatar Mar 04 '19 10:03 gbaptista

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

olebedev avatar Mar 07 '19 10:03 olebedev

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.

mvgrimes avatar Apr 17 '23 15:04 mvgrimes

I've implement this is here

mvgrimes avatar Apr 17 '23 16:04 mvgrimes

@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.

olebedev avatar Apr 18 '23 07:04 olebedev