- Add support for Python 3.12
- Replace usage of deprecated
datetime.utcnow
anddatetime.utcfromtimestamp
.
- Drop support for Python 3.4 and 3.5.
- Fix compatibility issue with Python 3.4 and 3.5 by replacing f-string usage with string-format.
- Add Python 3.9 support.
- Fix bug in
Zulu.time_from
,Zulu.time_to
,Zulu.time_from_now
, andZulu.time_to_now
where keyword arguments weren't passed to underlyingDelta.format
call. - Fix bug in
Zulu.format
where "YY" and "YYYY" format patterns would return the year in "Week of Year" based calendars instead of the regular calendar year.
- Add Python 3.8 support.
- Add
'week'
option toZulu.start_of
,Zulu.end_of
,Zulu.span
, andZulu.span_range
. Thanks ThomasChiroux! - Fix bug in
Zulu.astimezone
in Python 3.8 due to change in return type fromsuper().asdatetime
. In Python<=3.7,super().asdatetime
returned as instance ofdatetime
, but in Python 3.8 another instance ofZulu
was returned instead.Zulu.astimezone
will now return adatetime
instance in Python 3.8.
- Remove unused parameter in
zulu.Timer.__init__()
.
- Add
fold
attribute support toZulu
. - Add
zulu.to_seconds
for converting units of time to total number of seconds. - Add
zulu.Timer
class that can be used to track elapsed time (like a stopwatch) or as a countdown timer.
- Drop support for Python 2.7.
- Support Python 3.7.
- Add
Zulu.datetimetuple()
. - Add
Zulu.datetuple()
. - Remove
Zulu.__iter__
method. (breaking change) - Remove
Delta.__iter__
method. (breaking change)
- Add Python 3.6 support.
- Add
Delta.__iter__
method that yields 2-element tuples likeZulu.__iter__
. Delta values are normalized into integer values distributed from the higher units to the lower units. - Add
Delta.__float__
andDelta.__int__
methods for converting to seconds. - Add
Zulu.__float__
andZulu.__int__
methods for converting to epoch seconds. - Fix issue in Python 3.6 where
zulu.now()
returned a naive datetimeZulu
instance. - Make
Zulu.__iter__
yield 2-element tuples containing(unit, value)
like(('year', 2000), ('month', 12), ...)
so it can be converted to adict
with proper keys easier. (breaking change) - Remove previously deprecated
zulu.delta()
function. Usezulu.parse_delta()
instead. (breaking change) - Rename modules: (breaking change)
zulu.datetime -> zulu.zulu
zulu.timedelta -> zulu.delta
- Provide fallback for the default value of
locale
inDelta.format()
when a locale is not known via environment variables.
- Add
zulu.parse_delta
as alias forDelta.parse
. - Deprecate
zulu.delta
in favor ofzulu.parse_delta
. - Allow first argument to
Zulu()
,Zulu.parse()
, andzulu.parse()
to be adict
containing keys corresponding to initialization parameters. - Fix error message for invalid timezone strings so that the supplied string is shown correctly.
- Require
python-dateutil>=2.6.0
. (breaking change) - Replace usage of
pytz
timezone handling for strings withdateutil.tz.gettz
. Continue to supportpytz
timezones duringZulu()
object creation. (breaking change). - Replace default UTC timezone with
dateutil.tz.tzutc()
. Was previouslypytz.UTC
. (breaking change) - Replace local timezone with
dateutil.tz.tzlocal()
. Was previously set by thetzlocal
library. (breaking change)
- Add comparison methods to
Zulu
:is_before
is_on_or_before
is_after
is_on_or_after
is_between
- Optimize
Zulu()
constructor by eliminating multiple unnecessary calls todatetime
constructor.
- Fix
Zulu
not being pickle-able.
- Add missing magic method overrides for
Delta
for+delta
,-delta
, andabs(delta)
so thatDelta
is returned instead ofdatetime.timedelta
.__pos__
__neg__
__abs__
- Make
Zulu.__sub__
andZulu.subtract
return aDelta
object instead ofdatetime.timedelta
. - Make
zulu.delta
andZulu.Delta.parse
accept a number. - Allow the first argument to
Zulu.shift
be a timedelta or relative delta object. - Ensure that mathematical magic methods for
Delta
returnDelta
objects and notdatetime.timedelta
.__add__
__radd__
__sub__
__mul__
__rmul__
__floordiv__
__truediv__
(Python 3 only)__div__
(Python 2 only)__mod__
(Python 3 only)__divmod__
(Python 3 only)
- Replace internal implementation of Unicode date pattern formatting with Babel's
format_datetime
. breaking change - Remove support for formatting to timestamp using
X
andXX
. breaking change - Rename parse-from-timestamp token from
X
totimestamp
. breaking change - Add
zulu.create
as factory function to create azulu.Zulu
instance. - Add locale support to
Zulu.format
when using Unicode date pattern format tokens. - Restore locale support to
Delta.format
.
- Remove locale support from
Delta.format
. Locale is currently not supported inZulu.format
so decided to disable it inDelta.format
until both can have it. breaking change
- Rename
zulu.DateTime
tozulu.Zulu
. breaking change - Rename
Zulu.isleap
toZulu.is_leap_year
. breaking change - Remove
zulu.format
alias (function can be accessed atzulu.parser.format_datetime
). breaking change - Remove
Zulu.leapdays
. breaking change - Add
Zulu.days_in_month
. - Add
zulu.Delta
class that inherits fromdatetime.timedelta
. - Add
zulu.delta
as alias tozulu.Delta.parse
. - Add
Zulu.time_from
,Zulu.time_to
,Zulu.time_from_now
, andZulu.time_to_now
that return "time ago" or "time to" humanized strings. - Add
zulu.range
as alias toZulu.range
. - Add
zulu.span_range
as alias toZulu.span_range
. - Make time units (years, months, weeks, days, hours, minutes, seconds, microseconds) keyword arguments only for
Zulu.add/subtract
, but allow positional argument to be an addable/subtractable object (datetime, timedelta, dateutil.relativedelta). breaking change
- Rename
DateTime.sub
toDateTime.subtract
. breaking change - Allow the first argument to
DateTime.add
to be adatetime.timedelta
ordateutil.relativedelta
object. - Allow the first argument to
DateTime.subtract
to be aDateTime
,datetime.datetime
,datetime.timedelta
, ordateutil.relativedelta
object. - Provide
zulu.ISO8601
andzulu.TIMESTAMP
as parse/format constants that can be used inzulu.parse(string, zulu.ISO8601)
andDateTime.format(zulu.ISO8601)
. - Remove special parse format string
'timestamp'
in favor of using just'X'
as defined inzulu.TIMESTAMP
. breaking change - Import
zulu.parser.format
tozulu.format
. - Fix bug in
DateTime
addition operation that resulted in a nativedatetime
being returned instead ofDateTime
.
- Add
DateTime.datetime
property that returns a native datetime. - Add
DateTime.fromgmtime
that creates aDateTime
from a UTC basedtime.struct_time
. - Add
DateTime.fromlocaltime
that creates aDateTime
from a localtime.struct_time
. - Add
DateTime.isleap
method that returns whether its year is a leap year. - Add
DateTime.leapdays
that calculates the number of leap days between its year and another year. - Add
DateTime.start_of/end_of
and other variants that return the start of end of a time frame:start/end_of_century
start/end_of_decade
start/end_of_year
start/end_of_month
start/end_of_day
start/end_of_hour
start/end_of_minute
start/end_of_second
- Add
DateTime.span
that returns the start and end of a time frame. - Add
DateTime.span_range
that returns a range of spans. - Add
DateTime.range
that returns a range of datetimes. - Add
DateTime.add
andDateTime.sub
methods. - Add
years
andmonths
arguments toDateTime.shift/add/sub
. - Drop support for milliseconds from
DateTime.shift/add/sub
. breaking change - Make
DateTime.parse/format
understand a subset of Unicode date patterns. - Set defaults for year (1970), month (1), and day (1) arguments to new
DateTime
objects. Creating a newDateTime
now defaults to the start of the POSIX epoch.
- Don't pin install requirements to a specific version; use
>=
instead.
- Fix bug in
DateTime.naive
that resulted in aDateTime
object being returned instead of a nativedatetime
.
- First release.