Closed ca1f closed 3 years ago
Thank you for the report!
I did end up pushing a fix for this, however the end result Is still not possibly same as you seek. I was not able to repro results above without overriding time.Local https://play.golang.org/p/EK_VQP5SjTD
./dateparse --timezone="Europe/Amsterdam" "Thu, 17 Dec 2020 16:39:13 CET"
Your Current time.Local zone is PST
Layout String: dateparse.ParseFormat() => Mon, 02 Jan 2006 15:04:05 MST
Your Using time.Local set to location=Europe/Amsterdam CET
+-------------+---------------------------+-------------------------------+-------------------------------------+
| method | Zone Source | Parsed | Parsed: t.In(time.UTC) |
+-------------+---------------------------+-------------------------------+-------------------------------------+
| ParseAny | time.Local = nil | 2020-12-17 16:39:13 +0000 CET | 2020-12-17 16:39:13 +0000 UTC day=4 |
| ParseAny | time.Local = timezone arg | 2020-12-17 16:39:13 +0100 CET | 2020-12-17 15:39:13 +0000 UTC day=4 |
| ParseAny | time.Local = time.UTC | 2020-12-17 16:39:13 +0000 CET | 2020-12-17 16:39:13 +0000 UTC day=4 |
| ParseIn | time.Local = nil | 2020-12-17 16:39:13 +0000 CET | 2020-12-17 16:39:13 +0000 UTC |
| ParseIn | time.Local = timezone arg | 2020-12-17 16:39:13 +0100 CET | 2020-12-17 15:39:13 +0000 UTC |
| ParseIn | time.Local = time.UTC | 2020-12-17 16:39:13 +0000 CET | 2020-12-17 16:39:13 +0000 UTC |
| ParseLocal | time.Local = nil | 2020-12-17 16:39:13 +0000 CET | 2020-12-17 16:39:13 +0000 UTC |
| ParseLocal | time.Local = timezone arg | 2020-12-17 16:39:13 +0100 CET | 2020-12-17 15:39:13 +0000 UTC |
| ParseLocal | time.Local = time.UTC | 2020-12-17 16:39:13 +0000 CET | 2020-12-17 16:39:13 +0000 UTC |
| ParseStrict | time.Local = nil | 2020-12-17 16:39:13 +0000 CET | 2020-12-17 16:39:13 +0000 UTC |
| ParseStrict | time.Local = timezone arg | 2020-12-17 16:39:13 +0100 CET | 2020-12-17 15:39:13 +0000 UTC |
| ParseStrict | time.Local = time.UTC | 2020-12-17 16:39:13 +0000 CET | 2020-12-17 16:39:13 +0000 UTC |
+-------------+---------------------------+-------------------------------+-------------------------------------+
It seems that the CET timezone is not properly detected.
Adding the values
Thu, 17 Dec 2020 15:39:13 GMT
andThu, 17 Dec 2020 16:39:13 CET
to the example and verifying that these values are pointing to the same time withParsing these values with
dateparse.ParseAny
yields the following results:These are not the same.
Expected results: