This version brings small changes and performance improvements.
New features
Support for EXIF-formatted strings in parse()
Pendulum now supports parsing EXIF datetime strings (in the form YYYY:MM:DD hh:mm:ss
).
>>> import pendulum
>>> pendulum.parse('2016:12:26 15:45:28')
# <Pendulum [2016-12-26T15:45:28+00:00]>
Changes
Performance improvements when parsing ISO 8601 strings
This version adds a C extension to improve ISO 8601 string parsing performances.
Under the hood it uses the parse_iso8601()
helper (only available with C extensions activated)
which is the fastest and most accurate ISO 8601 datetime parser in Python. Let's take a look:
2012-123
parse_iso8601 | ciso8601 | aniso8601 | iso8601 | isodate |
---|---|---|---|---|
4ms | Wrong result (2012-12-03) | 238ms | Wrong result (2012-12-03) | 82ms |
2012123
parse_iso8601 | ciso8601 | aniso8601 | iso8601 | isodate |
---|---|---|---|---|
5ms | Wrong result (2012-12-03) | 250ms | Error | 92ms |
2012-W05-7
parse_iso8601 | ciso8601 | aniso8601 | iso8601 | isodate |
---|---|---|---|---|
6ms | Error | 117ms | Error | 111ms |
2013-12-23T12:34:56.123456+05:30
parse_iso8601 | ciso8601 | aniso8601 | iso8601 | isodate |
---|---|---|---|---|
5ms | 68ms | 651ms | 365ms | 358ms |
20131223T123456.123456+0530
parse_iso8601 | ciso8601 | aniso8601 | iso8601 | isodate |
---|---|---|---|---|
6ms | 68ms | 633ms | 356ms | Wrong result (2013-12-23 12:34:56.123456+05:00) |
Fixes
Fixed parsing of ISO 8601 week dates.
>>> import pendulum # Before >>> pendulum.parse('2009-W01-1') <Pendulum [2009-01-05T00:00:00+00:00]> # Wrong should be 2008-12-29 >>> pendulum.parse('2009-W53-7') # ParserError: Invalid date string: 2009-W53-7 # Now >>> pendulum.parse('2009-W01-1') <Pendulum [2008-12-29T00:00:00+00:00]> >>> pendulum.parse('2009-W53-7') <Pendulum [2010-01-03T00:00:00+00:00]>
Fixed
eu
andsk
locales. (Thanks to eumiro)