Fix the negative timezone offset bug revealed in the previous commit
This is a simpler fix than gh-270, and doesn't try to do several
things at once.
commitb5468a0bc5a4465c435c4b5d2a2e071dda0cda38
authorBryan O'Sullivan <bos@serpentine.com>
dateTue 21 Jul 2015, 00:00 (11 years ago)
parent62ba912
Data/Aeson/Parser/Time.hs+6−5
@@ -98,12 +98,13 @@ timeZone = do
9898 if ch == 'Z'
9999 then return Nothing
100100 else do
101− h0 <- twoDigits
101+ h <- twoDigits
102102 m <- maybeSkip ':' *> twoDigits
103− let h | ch == '-' = negate h0
104− | otherwise = h0
105− case h * 60 + m of
106− off | off == 0 ->
103+ let off | ch == '-' = negate off0
104+ | otherwise = off0
105+ off0 = h * 60 + m
106+ case undefined of
107+ _ | off == 0 ->
107108 return Nothing
108109 | off < -720 || off > 840 || m > 59 ->
109110 fail "invalid time zone offset"