Matthew Schinckel  committed 9eb3e7c

Inspect the date[time] object to see if we should be putting TZ in there.

  • Participants
  • Parent commits a26ff1c
  • Branches default

Comments (0)

Files changed (1)

File jsonfield/

     if isinstance(o, Decimal):
         return str(o)
     if isinstance(o, datetime.datetime):
+        if o.tzinfo:
+            return o.strftime('%Y-%m-%dT%H:%M:%S%z')
         return o.strftime("%Y-%m-%dT%H:%M:%S")
     if isinstance(o,
         return o.strftime("%Y-%m-%d")
     if isinstance(o, datetime.time):
+        if o.tzinfo:
+            return o.strftime('%H:%M:%S%z')
         return o.strftime("%H:%M:%S")
     raise TypeError(repr(o) + " is not JSON serializable")