##// END OF EJS Templates
date: parse ISO-style Z and +hh:mm timezone specs
Matt Mackall -
r29637:46b2ccce stable
parent child Browse files
Show More
@@ -1760,6 +1760,18 b' def parsetimezone(s):'
1760 minutes = int(s[-2:])
1760 minutes = int(s[-2:])
1761 return -sign * (hours * 60 + minutes) * 60, s[:-5].rstrip()
1761 return -sign * (hours * 60 + minutes) * 60, s[:-5].rstrip()
1762
1762
1763 # ISO8601 trailing Z
1764 if s.endswith("Z") and s[-2:-1].isdigit():
1765 return 0, s[:-1]
1766
1767 # ISO8601-style [+-]hh:mm
1768 if (len(s) >= 6 and s[-6] in "+-" and s[-3] == ":" and
1769 s[-5:-3].isdigit() and s[-2:].isdigit()):
1770 sign = (s[-6] == "+") and 1 or -1
1771 hours = int(s[-5:-3])
1772 minutes = int(s[-2:])
1773 return -sign * (hours * 60 + minutes) * 60, s[:-6]
1774
1763 return None, s
1775 return None, s
1764
1776
1765 def strdate(string, format, defaults=[]):
1777 def strdate(string, format, defaults=[]):
General Comments 0
You need to be logged in to leave comments. Login now