araddon / dateparse

GoLang Parse many date strings without knowing format in advance.
MIT License
2.03k stars 164 forks source link

Does not respect offset for format (time) UTC[+-]NNNN #158

Open klondikedragon opened 8 months ago

klondikedragon commented 8 months ago

Currently it will parse Mon, 1 Dec 2008 14:48:22 GMT-07:00 into 2008-12-01 21:48:22 +0000 UTC (giving special treatment to GMT[+-]NNNN as really another way of just specifying the offset [+-]NNNN.

This makes sense, as this syntax is a way of specifying a timezone as an offset from GMT or UTC.

However, it currently does not give the same special treatment to Mon, 1 Dec 2008 14:48:22 UTC-07:00 -- instead it will just treat this as the UTC time zone and ignore the specified offset (this is due to the special parsing rules of how golang time.Parse always recognizes the "UTC" time zone abbreviation).

For consistency and accuracy, it should treat these cases the same and recognize the offset.

A PR will be opened that fixes this behavior, this is documenting the need/enhancement.