-
Notifications
You must be signed in to change notification settings - Fork 169
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
Could not find date format for "2017-12-02" #29
Comments
Thanks for report, but i can't currently reproduce that. Can you try running the https://github.com/araddon/dateparse/tree/master/dateparse Or what OS is this? What time-zone is local? $ go version
go version go1.9.1 linux/amd64
$ dateparse --timezone="UTC" "2017-12-02"
Your Current time.Local zone is PST
+------------+---------------------------+-------------------------------+-------------------------------+
| method | Zone Source | Parsed | Parsed: t.In(time.UTC) |
+------------+---------------------------+-------------------------------+-------------------------------+
| ParseAny | time.Local = nil | 2017-12-02 00:00:00 +0000 UTC | 2017-12-02 00:00:00 +0000 UTC |
| ParseAny | time.Local = timezone arg | 2017-12-02 00:00:00 +0000 UTC | 2017-12-02 00:00:00 +0000 UTC |
| ParseAny | time.Local = time.UTC | 2017-12-02 00:00:00 +0000 UTC | 2017-12-02 00:00:00 +0000 UTC |
| ParseIn | time.Local = nil | 2017-12-02 00:00:00 +0000 UTC | 2017-12-02 00:00:00 +0000 UTC |
| ParseIn | time.Local = timezone arg | 2017-12-02 00:00:00 +0000 UTC | 2017-12-02 00:00:00 +0000 UTC |
| ParseIn | time.Local = time.UTC | 2017-12-02 00:00:00 +0000 UTC | 2017-12-02 00:00:00 +0000 UTC |
| ParseLocal | time.Local = nil | 2017-12-02 00:00:00 +0000 UTC | 2017-12-02 00:00:00 +0000 UTC |
| ParseLocal | time.Local = timezone arg | 2017-12-02 00:00:00 +0000 UTC | 2017-12-02 00:00:00 +0000 UTC |
| ParseLocal | time.Local = time.UTC | 2017-12-02 00:00:00 +0000 UTC | 2017-12-02 00:00:00 +0000 UTC |
+------------+---------------------------+-------------------------------+-------------------------------+
|
Same problem here
|
ok, thx for the report alex . I see the issue which is the dd/mm/yyyy format which is ambiguous to this type of parsing compared to mm/dd/yyyy . I think the options are: // for ambiguous
dateparse.ParsePreferEu("18/03/2000") Or possibly look at time.Local to recognize zones that are dd/mm/yyyy vs mm/dd/yyy |
I tried
with The funny thing is that native time.* cannot process this date format |
Very possibly wrong, but I don't think the time zone affects the disambiguation of the time parser. That format would remain ambiguous regardless of zone, I think. The |
Fairly certain this is actually the same issue as #28 |
Get the error
Could not find date format for "2017-12-02"
when doingdateparse.ParseAny("2017-12-02")
Golang: 1.9
The text was updated successfully, but these errors were encountered: