Open
Description
The v1.0.0 release of Arrow contains breaking changes, this migration guide outlines the changed APIs and functionality. Please visit #923 to discuss the changes and ask any questions.
-
Python
2.7
and3.5
are no longer supported. -
The
.timestamp
property has been removed to improve compatibility withdatetime
. Use.int_timestamp
for the same results.
>>> arrow.utcnow().int_timestamp
1608640233
- Arrow has a new method
timestamp()
which wraps thedatetime
method of the same name.
>>> arrow.utcnow().timestamp()
1608641039.22176
- It's no longer possible to set the
tzinfo
property directly, instead usereplace()
.
>>> dt=arrow.utcnow()
>>> dt.tzinfo=tz.gettz("US/Pacific")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: can't set attribute
>>> dt.replace(tzinfo=tz.gettz("US/Pacific"))
<Arrow [2020-12-22T16:03:29.630250-08:00]>
arrow.get(None)
now returns an error rather than current UTC.
>>> arrow.get(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/chris/arrow/arrow/api.py", line 80, in get
return _factory.get(*args, **kwargs)
File "/home/chris/arrow/arrow/factory.py", line 228, in get
raise TypeError("Cannot parse argument of type None.")
TypeError: Cannot parse argument of type None.
- The
"X"
token now returns afloat
rather than anint
.
>>> arrow.utcnow().format("X")
'1614719652.85991'