# HG changeset patch # User Matt Mackall # Date 2016-07-27 20:20:34 # Node ID 46b2ccce7fde422d6738fa43c8eaa4a2be3bfef4 # Parent 84ef4517de033f218d7b27d5a1f4a0a152f496bd date: parse ISO-style Z and +hh:mm timezone specs diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1760,6 +1760,18 @@ def parsetimezone(s): minutes = int(s[-2:]) return -sign * (hours * 60 + minutes) * 60, s[:-5].rstrip() + # ISO8601 trailing Z + if s.endswith("Z") and s[-2:-1].isdigit(): + return 0, s[:-1] + + # ISO8601-style [+-]hh:mm + if (len(s) >= 6 and s[-6] in "+-" and s[-3] == ":" and + s[-5:-3].isdigit() and s[-2:].isdigit()): + sign = (s[-6] == "+") and 1 or -1 + hours = int(s[-5:-3]) + minutes = int(s[-2:]) + return -sign * (hours * 60 + minutes) * 60, s[:-6] + return None, s def strdate(string, format, defaults=[]):