dateparse
dateparse copied to clipboard
Request: Support for DD/MM/YYYY
Hello!
I noticed dateparse doesn't currently have support for UK based dates, is this within scope?
Flipped examples from mm/dd/yyyy:
// dd/mm/yyyy
"31/3/2014",
"31/03/2014",
"21/08/71",
"1/8/71",
"8/4/2014 22:05",
"08/04/2014 22:05",
"2/04/2014 03:00:51",
"8/8/1965 12:00:00 AM",
"8/8/1965 01:00:01 PM",
"8/8/1965 01:00 PM",
"8/8/1965 1:00 PM",
"8/8/1965 12:00 AM",
"4/02/2014 03:00:51",
"19/03/2012 10:11:59",
"19/03/2012 10:11:59.3186369",
Let me play around and see what that would look like. Since dd/mm vs mm/dd are ambiguous for this state-machine, I think it would have to be declarative (different function name).
Still working on this. Have finished refactor as precursor and will create an API to prefer DD/MM when ambigous.
Internationally, dd/mm is way more common than mm/dd, right? Afaik, only the USA uses mm/dd, while the entire rest of the world uses mm/dd..
According to WP, DMY is by far the most used format, then YMD, distantly followed by the remainder including MDY.
What about using the system timezone to set a default format?
The current implementation of ParseStrict might be a bit more strict than it really needs to be. For date strings such as 13/08/2018, you can rule out any ambiguity because a) you have a 4-digit year, so you know which is the year part, and b) you know there's no month value greater than 12.
I'm currently stuck on this one too.. What about exposing the preferMonthFirst setting?
Hi, @matthewhartstonge
All the cases where the dd and mm is ambiguous are working correctly in my fix
https://github.com/araddon/dateparse/pull/133
You can use my fork while it is waiting for a merge
go get github.com/mehanizm/dateparse@ea6d70072703