diff options
author | Konstantin Molchanov <moigagoo@live.com> | 2017-03-29 16:42:48 +0400 |
---|---|---|
committer | Konstantin Molchanov <moigagoo@live.com> | 2017-03-29 16:42:48 +0400 |
commit | 0c121b38eccde230255d706131c46434e29018e1 (patch) | |
tree | a1b87e302f29e2d9ae2a4f32f830a45cd8840a18 | |
parent | a9044117e9af0d65f9a532a19c1ba44636533559 (diff) | |
download | Nim-0c121b38eccde230255d706131c46434e29018e1.tar.gz |
Tests: JS: Times: Fix text so that it works in timezones other then UTC+4.
`parse` returns TimeInfo with the local timezone, which may not be the same as the one in the original string. To compare the moments encoded in the original string and returned by `parse`, we normalize them to UTC.
-rw-r--r-- | tests/js/ttimes.nim | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/js/ttimes.nim b/tests/js/ttimes.nim index 6420c8148..20ba14245 100644 --- a/tests/js/ttimes.nim +++ b/tests/js/ttimes.nim @@ -13,13 +13,14 @@ block yeardayTest: doAssert fromSeconds(2147483647).getGMTime().yearday == 18 block localTimezoneTest: - # check if timezone is properly set durint Time to TimeInfo conversion + # check if timezone is properly set during Time to TimeInfo conversion doAssert fromSeconds(2147483647).getLocalTime().timezone == getTimezone() block timestampPersistenceTest: # check if timestamp persists during TimeInfo to Time conversion const - testString = "2017-03-21T12:34:56+04:00" + timeString = "2017-03-21T12:34:56+03:00" + timeStringGmt = "2017-03-21T09:34:56+00:00" fmt = "yyyy-MM-dd'T'HH:mm:sszzz" - doAssert $testString.parse(fmt) == testString + doAssert $timeString.parse(fmt).toTime().getGMTime() == timeStringGmt |