Changelog

History of Pendulum

September 4th, 2017

1.2.5

Fixed

  • Fixed normalization of microseconds in durations.
  • Fixed microseconds not being included in `average()`. (Thanks to ericfrederich)
June 20th, 2017

1.2.4

Fixed

  • Fixed parsing of the now string.
June 18th, 2017

1.2.3

Fixed

  • Fixed behavior of some short timezones (like EST, MST or HST).
  • Fixed warning when building C extensions.
June 15th, 2017

1.2.2

Fixed

  • Fixed next() and previous() hanging when passed an invalid input.
  • Fixed wrong result when adding/subtracting a Period if a DST transition occurs.
May 23rd, 2017

1.2.1

Fixed

  • Fixed incorrect fold attribute on Python 3.6 when not passing a timezone. (Thanks to neonquill)
March 24th, 2017

1.2.0

Added

  • Added support for EXIF-formatted strings in parser. (Thanks to emattiza)

Changed

  • Improved performances when parsing ISO 8601 string with C extensions.

Fixed

  • Fixed parsing of ISO 8601 week dates.
  • Fixed eu and sk locales. (Thanks to eumiro)
March 14th, 2017

1.1.1

Fixed

  • Fixed diff_for_humans() when crossing DST transitions.
February 20th, 2017

1.1.0

Added

  • Added the keep_time keyword argument to next()/previous() methods to keep time information.

Changed

  • Greatly improved diff() performance.
  • Improved diff_for_humans() method to display more intuitive strings on edge cases.
  • Formatting (with f-strings or format()) will now use the configured formatter.
February 4th, 2017

1.0.2

Fixed

  • Adds support for external tzinfo as timezones. (Thanks to iv597)
  • Fixed day_of_year not returning the correct value. (Thanks to asrenzo)
January 25th, 2017

1.0.1

Fixed

  • Fixed parsing, especially for strings in the form 31-01-01.
January 17th, 2017

1.0.0

Changed

  • Using PRE_TRANSITION rule no longer produces a time in a DST gap.
  • Improved performances when adding time to a Pendulum instance.
  • Improved parsing of ISO 8601 strings.
  • Removed deprecated methods.
December 23rd, 2016

0.8.0

Added

  • Added on() and at() methods which replace with_date() and with_time().
  • Added a strict keyword argument to parse() to get the type matching the parsed string.
  • Added the ability to pass an amount to the range() method to control the length of the gap.
  • Added a datetime() helper method to the Timezone class.

Changed

  • Improved parsing of ISO 8601 strings.

Deprecated

  • with_date() and with_time() are deprecated. Use on() and at() instead.
  • create_from_date() and create_from_time() are deprecated. Use create() instead.
December 7th, 2016

0.7.0

Added

  • Added a Date class.
  • Added a Time class.
  • Added experimental support for the fold attribute introduced in Python 3.6.
  • Added a remaining_days property to the Interval class.
  • Added a int_timestamp property to the Pendulum class to retrieve the behavior of the now deprecated timestamp property.
  • start_of()/end_of() now supports hour, minute and second units.
  • astimezone() now supports timezone strings.
  • in_words() now displays subseconds when no other units are available.

Changed

  • Period properties (especially years and months) are now accurate.
  • Interval.seconds now returns the whole number of remaining seconds, like timedelta, for compatibility. Use remaining_seconds to retrieve the previous behavior.
  • Improved parsing performances for common formats.
  • The library no longer relies on pytz. It now depends on pytzdata for its timezone database.
  • Locale, test instance and formatter are now set gobally at the module level when using the corresponding module methods.

Deprecated

  • timestamp should now be used as a method and no longer as a property. It will be a native method in the next major version.
  • Interval properties and methods related to years and months are now deprecated.
  • Interval.days_exclude_weeks is now deprecated. Use remaining_days instead.

Fixed

  • Exception when loading specific timezones has been fixed.
  • end_of('day') now properly sets microseconds to 999999.
  • Accuracy of Period instances properties has been improved.
  • Accuracy for microseconds when initializing a Pendulum instance in some timezones has been fixed.
  • Periods are now serializable with pickle.
  • Fixed minute_(), second_() and microsecond_() setters changing the hour unit.
  • Fixed Windows support.
November 25th, 2016

0.6.6

Fixed

  • Fixed a memory leak in C extension. (thanks to ntoll)
October 31st, 2016

0.6.5

Changed

  • Adds validation to set_week_starts_at(), set_week_ends_at() and set_weekend_days(). (thanks to kleschenko)
  • Updates ukrainian localization. (thanks to kleschenko)

Fixed

  • Fixes loading of timezones without transitions.
  • Fixes Timezone.utcoffset(). (thanks to regnarock)
October 22th, 2016

0.6.4

Changed

  • Adds support for pytz timezones in constructor.

Fixed

  • Fixes behavior of add()/subtract() methods for years, months and days when a DST transition occurs.
  • Fixes range() behavior.
October 19th, 2016

0.6.3

Changed

  • Makes replace() accept the same tzinfo types as the constructor.

Fixed

  • Fixes timezone_() not setting the tzinfo properly.
  • Fixes pickling/unpickling of Pendulum instances with fixed timezone.
September 26th, 2016

0.6.2

Fixed

  • Fixes timezones loading on Windows.
September 19th, 2016

0.6.1

Changed

  • Pendulum instances can no longer be compared to strings and integers.

Fixed

  • Fixes Timezone._convert() method for fixed timezones.
  • Fixes instances() for some tzinfo.
  • Fixes comparisons to incompatible objects raising an error.
September 12th, 2016

0.6.0

Added

  • Adds an option to control transition normalization behavior.
  • Adds a separator keyword argument to Interval.in_words() method.
  • Adds an alternative formatter.
  • Adds support for pretty much any tzinfo instance in the instance() method.
  • Adds an intersect() method to the Period class

Changed

  • Improves meridians formatting by supporting minutes.
  • Changes behavior of create*() methods (time now defaults to 00:00:00)

Fixed

  • Fixes setters and modifiers (start_of/end_of) to properly apply transitions.
  • Fixes issue when compiling on 32 bit systems. (Thanks to guyzmo)
  • Fixes NameError Exception on Python 3.2. (Thanks to guyzmo)
  • Fixes absolute intervals.
September 1st, 2016

0.5.5

Fixed

  • Fixes local timezone loading for unix systems.
  • Fixes potential AttributeError in between() method. (Thanks to iv597)
August 30th, 2016

0.5.4

Fixed

  • Fixes the broken previous release (0.5.3) where a missing locale module would cause an ImportError.
August 29th, 2016

0.5.3

Fixed

  • Fixes setters and modifiers (start_of()/end_of()) to properly apply DST transitions.
  • Fixes timezone file loading on some installs (See #34) (Thanks to mayfield)
August 22nd, 2016

0.5.2

Added

  • Adds a small speedup when changing timezones.
  • Makes .offset_hours return a float.

Fixed

  • Fixes TimezoneInfo.utcoffset() method.
  • Fixes arithmetic operations on intervals not returning intervals.
  • Allows Pendulum instances comparison to None. (Thanks to jkeyes)
August 18th, 2016

0.5.1

Fixed

  • Fixes now() not behaving properly when given a timezone.
  • Fixes double file opening when getting local timezone. (Thanks to yggdr)
  • Fixes pt_BR locale. (Thanks to YomoFuno)
  • Fixes pl locale. (Thanks to MichalTHEDUDE)
August 15th, 2016

0.5

This version introduces a new timezone library which improves timezone switching and behavior around DST transition times.

Added

  • Adds a new timezone library to properly normalize and localize datetimes. Pendulum no longer relies on pytz. Check the Documentation to see what has changed exactly.
    import pendulum
    
    pendulum.create(2013, 3, 31, 2, 30, 0, 0, 'Europe/Paris')
    # 2:30 for the 31th of March 2013 does not exist
    # so pendulum will return the actual time which is 3:30+02:00
    '2013-03-31T03:30:00+02:00'
    
    pendulum.create(2013, 10, 27, 2, 30, 0, 0, 'Europe/Paris')
    # Here, 2:30 exists twice in the day so pendulum will
    # assume that the transition already occurred
    '2013-10-27T02:30:00+01:00'
    
    dt = pendulum.create(2013, 3, 31, 1, 59, 59, 999999, 'Europe/Paris')
    '2013-03-31T01:59:59.999999+01:00'
    dt = dt.add(microseconds=1)
    '2013-03-31T03:00:00+02:00'
    dt.subtract(microseconds=1)
    '2013-03-31T01:59:59.999998+01:00'
    
    dt = pendulum.create(2013, 10, 27, 1, 59, 59, 999999, 'Europe/Paris')
    dt = dt.add(hours=1)
    # We can't just do
    # pendulum.create(2013, 10, 27, 2, 59, 59, 999999, 'Europe/Paris')
    # because of the default normalization
    '2013-10-27T02:59:59.999999+02:00'
    dt = dt.add(microseconds=1)
    '2013-10-27T02:00:00+01:00'
    dt = dt.subtract(microseconds=1)
    '2013-10-27T02:59:59.999999+02:00'
    
July 26th, 2016

0.4

This version mostly brings the new Period class and improves performances overall.
  • Adds the Period class, which basically is a datetime-aware interval.
    dt1 = pendulum.now()
    dt2 = dt1.add(days=3)
    
    # A period is the difference between 2 instances
    period = dt2 - dt1
    
    period.in_weekdays()
    period.in_weekend_days()
    
    # A period is iterable
    for dt in period:
        print(dt)
                              
  • Makes the format() method support a locale keyword argument.
    dt = Pendulum(1975, 5, 21)
    
    dt.format('%A %d %B %Y', locale='de')
    'Mittwoch 21 Mai 1975'
    
    dt.format('%A %d %B %Y')
    'Wednesday 21 May 1975'
                              
  • Changes custom directives. %P becomes %_z and %t becomes %_t. Basically, all new custom directives will be in the form %_{directive}
  • Fixes singular for negative values of intervals.
July 13th, 2016

0.3.1

  • Fixes parsing of string with partial offset.
July 11th, 2016

0.3

This version causes major breaking API changes to simplify it and making it more intuitive.
  • Improves testing by providing a test() contextmanager.
    known = pendulum.create(2001, 5, 21, 12)
    
    with pendulum.test(known):
        print(pendulum.now())
        # 2001-05-21T12:00:00+00:00
    
    print(pendulum.now())
    # 2016-07-10T22:10:33.954851-05:00
                              
  • Makes passing a naive datetime to instance() default to UTC.
  • Reduces add_xxx()/sub_xxx() methods to add(**kwargs)/subtract(**kwargs).
    # Before
    pendulum.now().add_days(3)
    
    # Now
    pendulum.now().add(days=3)
                              
  • Changes the for_humans() method of the Interval class to in_words() to avoid confusion with the diff_for_humans() method.
  • Makes more constants and methods available at module level.
  • Makes the constructor behave like the standard one. No more Pendulum().
  • Fixes "sl" locale.
  • Renames the to() method to in_timezone().
    # Before
    pendulum.now().to('Europe/Paris')
    
    # Now
    pendulum.now().in_timezone('Europe/Paris')
                              
  • Removes the comparison methods to just stick with the basic operators.
  • Reduces first_of_xxx()/last_of_xxx()/nth_of_xxx() methods to first_of(unit)/last_of(unit)/nth_of(unit, nth).
    # Before
    pendulum.now().first_of_month()
    pendulum.now().nth_of_year(7, pendulum.MONDAY)
    
    # Now
    pendulum.now().first_of('month')
    pendulum.now().nth_of('year', 7, pendulum.MONDAY)
                              
  • Reduces start_of_xxx()/end_of_xxx() methods to start_of(unit)/end_of(unit).
    # Before
    pendulum.now().start_of_day()
    
    # Now
    pendulum.now().start_of('day')
                              
  • Removes the diff_in_xxx() methods from the Pendulum and adds in_xxx() methods to the Interval class.
    # Before
    dt_ottawa.diff_in_hours(dt_vancouver)
    
    # Now
    dt_ottawa.diff(dt_vancouver).in_hours()
                              
  • Renames the PendulumInterval class to simply Interval
  • Makes the Pendulum class immutable.
July 5th, 2016

0.2

  • Makes the Pendulum class truly inherits from datetime
July 4th, 2016

0.1.1

  • Adds support for the TZ environment variable
  • Adds closest()/farthest() comparison methods
  • Makes set_test_now() available at module level
  • Adds min/max attributes. Renames min/max methods.
  • Fixes diff_for_humans() method when setting locale.
July 4th, 2016

0.1

Initial Release