]> jfr.im git - z_archive/twitter.git/commitdiff
Fix timezone bug introduced in previous commit
authorMatthew Cengia <redacted>
Sat, 22 Jun 2013 07:32:19 +0000 (17:32 +1000)
committerMatthew Cengia <redacted>
Sat, 22 Jun 2013 07:32:19 +0000 (17:32 +1000)
Removed too much code; wasn't converting to local timezone anymore

twitter/archiver.py

index 1be6d6d217004bda793c24e412a4524a76ea1ab0..6f2468a6e03cec1120a88d15bc5bf32a4ba9f20a 100644 (file)
@@ -133,11 +133,14 @@ def format_date(utc, isoformat=False):
     """Parse Twitter's UTC date into UTC or local time."""
     u = datetime.strptime(utc.replace('+0000','UTC'), '%a %b %d %H:%M:%S %Z %Y')
     # This is the least painful way I could find to create a non-naive
-    # datetime that included a timezone of UTC. Alternative suggestions
+    # datetime including a UTC timezone. Alternative suggestions
     # welcome.
     unew = datetime.combine(u.date(), time(u.time().hour,
         u.time().minute, u.time().second, tzinfo=UTC))
 
+    # Convert to localtime
+    unew = unew.astimezone(Local)
+
     if isoformat:
         return unew.isoformat()
     else: