aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-11-27 01:22:43 +0000
committerMatthew Wild <mwild1@gmail.com>2010-11-27 01:22:43 +0000
commit85d3f7707ead334c38173e86e4267ef23e880666 (patch)
tree4345078b186c934f5e727947c97d26c4a6875b98 /util
parente058268edaa505532bee611459b253ec000df841 (diff)
downloadprosody-85d3f7707ead334c38173e86e4267ef23e880666.tar.gz
prosody-85d3f7707ead334c38173e86e4267ef23e880666.zip
util.datetime: Fixes for more liberal timezone parsing - colon and minutes are both (independantly) optional (thanks Zash)
Diffstat (limited to 'util')
-rw-r--r--util/datetime.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/datetime.lua b/util/datetime.lua
index e853ff78..76efc21b 100644
--- a/util/datetime.lua
+++ b/util/datetime.lua
@@ -41,8 +41,9 @@ function parse(s)
local time_offset = os_difftime(os_time(os_date("*t")), os_time(os_date("!*t"))); -- to deal with local timezone
local tzd_offset = 0;
if tzd ~= "" and tzd ~= "Z" then
- local sign, h, m = tzd:match("([+%-])(%d%d):(%d%d)");
+ local sign, h, m = tzd:match("([+%-])(%d%d):?(%d*)");
if not sign then return; end
+ if #m ~= 2 then m = "0"; end
h, m = tonumber(h), tonumber(m);
tzd_offset = h * 60 * 60 + m * 60;
if sign == "-" then tzd_offset = -tzd_offset; end