diff --git a/lib/misc.lua b/lib/misc.lua index cd07596..bf11647 100644 --- a/lib/misc.lua +++ b/lib/misc.lua @@ -8,17 +8,17 @@ function parse_hex_color(text) end function parse_iso8601_date(json_date) - local pattern = "(%d+)%-(%d+)%-(%d+)%a(%d+)%:(%d+)%:([%d%.]+)([Z%+%-])(%d?%d?)%:?(%d?%d?)" + local pattern = "(%d+)%-(%d+)%-(%d+)%a(%d+)%:(%d+)%:([%d%.]+)([Z%+%-]?)(%d?%d?)%:?(%d?%d?)" local year, month, day, hour, minute, seconds, offsetsign, offsethour, offsetmin = json_date:match(pattern) local timestamp = os.time{year = year, month = month, day = day, hour = hour, min = minute, sec = seconds} local offset = 0 - if offsetsign ~= 'Z' then + if offsetsign ~= '' and offsetsign ~= 'Z' then offset = tonumber(offsethour) * 60 + tonumber(offsetmin) if xoffset == "-" then offset = offset * -1 end end - return timestamp + offset + return timestamp + offset * 60 end