Henry Prêcheur avatar Henry Prêcheur committed 2576d7e

Fix timezone sign

Comments (0)

Files changed (1)

 def _time_offset(read):
     x = read(1)
 
-    if x == 'Z':
+    if x.upper() == 'Z':
         return (0, True)
 
     if x == '+':
     if minute >= 60:
         return
 
-    return (hour * 60 + minute, False)
+    return (sign * (hour * 60 + minute), False)
 
 def parse(s):
     '''
     if i.read(1).upper() != 'T':
         return
     time = _time(i.read)
-    secfrac = (_time_secfrac(i),)
+    secfrac = _time_secfrac(i)
     if secfrac is None:
         secfrac = 0
     offset = _time_offset(i.read)
 
-    return date + time + secfrac + offset
+    return date + time + (secfrac, offset)
 
 if __name__ == '__main__':
     print parse('1985-04-12T23:20:50.52Z')
+    print parse('1985-04-12T23:20:50Z')
     print parse('1985-04-12T23:20:50.52+01:00')
     print parse('1985-04-12T23:20:50.52-01:20')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.