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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gbaptista
Copy link
Contributor

  • SlashMDY

Fix: Common US dates not working. #10

@olebedev
Copy link
Owner

olebedev commented Mar 7, 2019

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 olebedev mentioned this pull request Feb 2, 2021
@mvgrimes
Copy link

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
Copy link

I've implement this is here

@olebedev
Copy link
Owner

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

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.

3 participants