{"push_id":823607590,"size":1,"distinct_size":1,"ref":"refs/heads/fix.date","head":"9050672b2840c1b8ff7a0b426c64c8915c748cfc","before":"0454a283b057b8ad879f0e19c91f41a69d3c6dde","commits":[{"sha":"9050672b2840c1b8ff7a0b426c64c8915c748cfc","author":{"email":"341ae4b10181e9ae5056162440771572020800f2@redhat.com","name":"Chris Ward"},"message":"Use UTC datetimes for Date()\n\nChanged the default behaivor of Date() to\nnormalize everything to UTC timezone datetime.datetime\ninstances instead of datetime.date to maintain the\ndatetime resolution for cases where it matters.\n\nAlso, while the default unicode(Date()) outout is\nYYYY-MM-DD, the format can now be changed on demand\nusing the fmt variable. eg (from tests/test_base.py)\n\n    from did.base import Date\n\n    d = '2015-01-01'\n    dt = '2015-01-01 00:00:00'\n    dtz = '2015-01-01 00:00:00 +0000'\n    dtz_cet = '2015-01-01 00:00:00 +0200'\n    # since we're 2 hours ahead, in UTC we're -2\n    dtz_cet_utc = '2014-12-31 22:00:00 +0000'\n    d_cet_utc = '2014-12-31'\n\n    # Default format will return the date in YYYY-MM-DD form\n    # after date conversion from defined timezone to UTC, if\n    # timezone is set on the incoming date value.\n    assert str(Date(d)) == d\n    assert str(Date(dt)) == str(d)\n    assert str(Date(dtz)) == str(d)\n    assert str(Date(dtz_cet)) == str(d_cet_utc)\n\n    # different formats should all work as strftime() expects\n    fmt = '%Y'\n    assert str(Date(d, fmt=fmt)) == '2015'\n    fmt = '%Y-%m-%d'\n    assert str(Date(d, fmt=fmt)) == d\n    fmt = '%Y-%m-%d %H:%M:%S'\n    assert str(Date(dt, fmt=fmt)) == dt\n    fmt = '%Y-%m-%d %H:%M:%S %z'\n    assert str(Date(dt, fmt=fmt)) == dtz\n    assert str(Date(d, fmt=fmt)) == dtz\n\n    # unicode works as expected\n    assert unicode(Date('2015-01-01')) == unicode(d)\n\n    # specify timezone\n    iso = '%Y-%m-%d %H:%M:%S %z'\n    assert unicode(Date(dtz_cet, fmt=iso)) == dtz_cet_utc\n\nRequires one new dependency - pytz http://pythonhosted.org/pytz/\n\nFixed some misc tests that depended on old Date features which\nneeded to be migrated.","distinct":true,"url":"https://api.github.com/repos/kejbaly2/did/commits/9050672b2840c1b8ff7a0b426c64c8915c748cfc"}]}