arrow icon indicating copy to clipboard operation
arrow copied to clipboard

Issue with the timezone preserving while invoking the shift method.

Open koonan opened this issue 4 years ago • 1 comments

Issue Description

Creating the same error, and converting it to Los Angeles time, and then shifting it with 0 seconds decreases the timezone offset with one, I think there is a problem with the daylight savings calculations.

import sys

import arrow

print(sys.version) # 3.8.9
print(arrow.__version__) # 1.2.1
print(arrow.get("2021-11-07T01:51:23-08:00").to("America/Los_Angeles").shift(seconds=0)) # -> 2021-11-07T01:51:23-07:00
print(arrow.get("2021-11-07T01:51:23-08:00").to("America/Los_Angeles")) # -> 2021-11-07T01:51:23-08:00

The desired outcome should be the same for the two invocations in there.

System Info

  • 🖥 OS name and version: Mac OS Big Sur Version 11.6
  • 🐍 Python version: 3.8.9
  • 🏹 Arrow version: 1.2.1

koonan avatar Nov 14 '21 20:11 koonan

Interesting, this is mainly due to this time being ambiguous in the America/Los_Angeles zone.

>>> dt1=arrow.get("2021-11-07T01:51:23-08:00").to("America/Los_Angeles")
>>> dt1
<Arrow [2021-11-07T01:51:23-08:00]>
>>> dt1.fold
1
>>> dt2=dt1.replace(fold=0)
>>> dt2
<Arrow [2021-11-07T01:51:23-07:00]>
>>> dt2.ambiguous
True

However the zero second shift does give a bizarre result on the surface, I will investigate further.

systemcatch avatar Nov 21 '21 18:11 systemcatch