Commits

Michael Twomey committed bbd9f30

Handle compact date format

Thanks to rvandolson@esri.com

Fixes #6

  • Participants
  • Parent commits d184602

Comments (0)

Files changed (3)

 * Fix pickling and deepcopy of returned datetime objects (https://bitbucket.org/micktwomey/pyiso8601/issue/3/dates-returned-by-parse_date-do-not) (thanks to fogathmann and john@openlearning.com)
 * Fix timezone offsets without a separator (https://bitbucket.org/micktwomey/pyiso8601/issue/4/support-offsets-without-a-separator) (thanks to joe.walton.gglcd)
 * "Z" produces default timezone if one is specified (https://bitbucket.org/micktwomey/pyiso8601/issue/5/z-produces-default-timezone-if-one-is) (thanks to vfaronov). This one may cause problems if you've been relying on default_timezone to use that timezone instead of UTC. Strictly speaking that was wrong but this is potentially backwards incompatible.
+* Handle compact date format (https://bitbucket.org/micktwomey/pyiso8601/issue/6/handle-compact-date-format) (thanks to rvandolson@esri.com)
 
 0.1.4
 -----

iso8601/iso8601.py

             year=to_int(groups, "year"),
             month=to_int(groups, "month"),
             day=to_int(groups, "day"),
-            hour=to_int(groups, "hour"),
+            hour=to_int(groups, "hour", default_to_zero=True),
             minute=to_int(groups, "minute", default_to_zero=True),
             second=to_int(groups, "second", default_to_zero=True),
             microsecond=groups["second_fraction"],

iso8601/test_iso8601.py

     ("20131015T18:30Z", datetime.datetime(2013, 10, 15, 18, 30, 0, 0, iso8601.UTC)),  # YYYYMMDD
     ("2012-12-19T23:21:28.512400+00:00", datetime.datetime(2012, 12, 19, 23, 21, 28, 512400, iso8601.FixedOffset(0, 0, "+00:00"))),  # https://code.google.com/p/pyiso8601/issues/detail?id=21
     ("2006-10-20T15:34:56.123+0230", datetime.datetime(2006, 10, 20, 15, 34, 56, 123000, iso8601.FixedOffset(2, 30, "+02:30"))),  # https://code.google.com/p/pyiso8601/issues/detail?id=18
+    ("19950204", datetime.datetime(1995, 2, 4, tzinfo=iso8601.UTC)),  # https://code.google.com/p/pyiso8601/issues/detail?id=1
 ])
 def test_parse_valid_date(valid_date, expected_datetime):
     parsed = iso8601.parse_date(valid_date)