Fix parsing for format (time) UTC[+-]NNNN

Fixes https://github.com/araddon/dateparse/issues/158
This commit is contained in:
Klondike Dragon
2023-12-14 22:57:42 -07:00
parent d05b099ca6
commit 14fb9398e4
2 changed files with 19 additions and 6 deletions

View File

@@ -1627,7 +1627,12 @@ iterRunes:
// 15:44:11 UTC+0100 2015
switch r {
case '+', '-':
if p.datestr[p.tzi:i] == "GMT" {
tzNameLower := strings.ToLower(p.datestr[p.tzi:i])
if tzNameLower == "gmt" || tzNameLower == "utc" {
// This is a special form where the actual timezone isn't UTC, but is rather
// specifying that the correct offset is a specified numeric offset from UTC:
// 06:20:00 UTC-05
// 06:20:00 GMT+02
p.tzi = 0
p.tzlen = 0
} else {