Skip to content

Commit

Permalink
Revert "Default to UTC for arrow.fromtimestamp() (arrow-py#1036)" (ar…
Browse files Browse the repository at this point in the history
…row-py#1037)

This reverts commit 8ad64d0.
  • Loading branch information
krisfremen committed Sep 6, 2021
1 parent 8ad64d0 commit 4c13420
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions arrow/arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,12 @@ def fromtimestamp(
the given timezone.
:param timestamp: an ``int`` or ``float`` timestamp, or a ``str`` that converts to either.
:param tzinfo: (optional) a ``tzinfo`` object. Defaults to UTC time.
:param tzinfo: (optional) a ``tzinfo`` object. Defaults to local time.
"""

if tzinfo is None:
tzinfo = dateutil_tz.tzutc()
tzinfo = dateutil_tz.tzlocal()
elif isinstance(tzinfo, str):
tzinfo = parser.TzinfoParser.parse(tzinfo)

Expand Down
7 changes: 4 additions & 3 deletions tests/test_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ def test_utcnow(self):

def test_fromtimestamp(self):

timestamp = datetime.utcnow().timestamp()
result = arrow.Arrow.fromtimestamp(timestamp, tzinfo=tz.tzutc())
timestamp = time.time()

result = arrow.Arrow.fromtimestamp(timestamp)
assert_datetime_equality(
result._datetime, datetime.fromtimestamp(timestamp, tz=tz.tzutc())
result._datetime, datetime.now().replace(tzinfo=tz.tzlocal())
)

result = arrow.Arrow.fromtimestamp(timestamp, tzinfo=tz.gettz("Europe/Paris"))
Expand Down

0 comments on commit 4c13420

Please sign in to comment.