diff options
Diffstat (limited to 'util/datetime.lua')
-rw-r--r-- | util/datetime.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/util/datetime.lua b/util/datetime.lua index abb4e867..2d27ece4 100644 --- a/util/datetime.lua +++ b/util/datetime.lua @@ -15,6 +15,7 @@ local os_difftime = os.difftime; local tonumber = tonumber; local _ENV = nil; +-- luacheck: std none local function date(t) return os_date("!%Y-%m-%d", t); @@ -37,7 +38,8 @@ local function parse(s) local year, month, day, hour, min, sec, tzd; year, month, day, hour, min, sec, tzd = s:match("^(%d%d%d%d)%-?(%d%d)%-?(%d%d)T(%d%d):(%d%d):(%d%d)%.?%d*([Z+%-]?.*)$"); if year then - local time_offset = os_difftime(os_time(os_date("*t")), os_time(os_date("!*t"))); -- to deal with local timezone + local now = os_time(); + local time_offset = os_difftime(os_time(os_date("*t", now)), os_time(os_date("!*t", now))); -- to deal with local timezone local tzd_offset = 0; if tzd ~= "" and tzd ~= "Z" then local sign, h, m = tzd:match("([+%-])(%d%d):?(%d*)"); |