times - remove unneeded negative sign when parsing formats z and zz (#9631)

* fix wrong utcoffset sign for formats z and zz

* add tests for the timezone offset formats
This commit is contained in:
pgkos 2018-11-06 22:29:23 +01:00 • committed by Arne Döring
commit b9cdad7497
2 changed files with 12 additions and 3 deletions

View file

@ -2026,9 +2026,9 @@ proc parsePattern(input: string, pattern: FormatPattern, i: var int,
var offset = 0
case pattern
of z:
offset = takeInt(1..2) * -3600
offset = takeInt(1..2) * 3600
of zz:
offset = takeInt(2..2) * -3600
offset = takeInt(2..2) * 3600
of zzz:
offset.inc takeInt(2..2) * 3600
if input[i] != ':':
@ -2508,4 +2508,4 @@ proc zoneInfoFromUtc*(zone: Timezone, time: Time): ZonedTime
proc zoneInfoFromTz*(zone: Timezone, adjTime: Time): ZonedTime
{.deprecated: "Use zonedTimeFromAdjTime instead".} =
## **Deprecated since v0.19.0:** use the ``zonedTimeFromAdjTime`` instead.
zone.zonedTimeFromAdjTime(adjTime)
zone.zonedTimeFromAdjTime(adjTime)