singhpratech opened a new issue, #51226:
URL: https://github.com/apache/arrow/issues/51226

   **Describe the bug**
   
   `assume_timezone` (and the other timezone-aware functions) apply the DST 
rule of `America/New_York`
   correctly up to 2037 and then stop: from 2038 on, a July instant gets the 
standard-time offset
   (UTC-5) instead of daylight time (UTC-4). The zoneinfo file on this machine 
is a "fat" TZif version 2
   file whose footer carries the POSIX rule `EST5EDT,M3.2.0,M11.1.0`, so the 
rule for years past the
   tabulated transitions is available in the file; `zoneinfo` from the Python 
standard library and
   `zdump` both apply it. #42157 covers slim files, where no transitions are 
tabulated at all; this
   happens with the fat file, once the tabulated transitions run out.
   
   pyarrow 25.0.1, Python 3.13.9, macOS 26.6 (arm64), wheel from PyPI, system 
zoneinfo at
   /usr/share/zoneinfo (America/New_York: 3552 bytes, TZif version 2, footer 
`EST5EDT,M3.2.0,M11.1.0`;
   `zdump -v` tabulates transitions through 2037 and extends by the footer rule 
after that).
   
   ```python
   import datetime as dt, zoneinfo, pyarrow as pa, pyarrow.compute as pc
   
   tz = zoneinfo.ZoneInfo("America/New_York")
   for year in (2025, 2037, 2038, 2050):
       naive = dt.datetime(year, 7, 15, 12, 0)                       # July: 
daylight time, UTC-4
       a = pa.array([naive], pa.timestamp("s"))
       utc = pc.assume_timezone(a, "America/New_York").cast(pa.timestamp("s", 
"UTC")).to_pylist()[0]
       off_pa = int((naive - utc.replace(tzinfo=None)).total_seconds())
       off_py = int(naive.replace(tzinfo=tz).utcoffset().total_seconds())
       print(year, "pyarrow", off_pa, "zoneinfo", off_py)
   ```
   
   Output:
   
   ```
   2025 pyarrow -14400 zoneinfo -14400
   2037 pyarrow -14400 zoneinfo -14400
   2038 pyarrow -18000 zoneinfo -14400
   2050 pyarrow -18000 zoneinfo -14400
   ```
   
   January instants give -18000 in every year, so from 2038 the offset is 
winter all year round.
   
   **Expected behavior**
   
   The offset for a July instant in 2038 and 2050 is -14400, as the file's 
footer rule and
   `zoneinfo` give; the last tabulated transition should not end DST for the 
zone.
   
   **Component(s)**
   
   C++, Python
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to