[C++][Python] Wrong result when converting time zones after 2038 · Issue #36110 · apache/arrow · GitHub
Skip to content

[C++][Python] Wrong result when converting time zones after 2038 #36110

Description

@MarcoGorelli

Describe the bug, including details regarding any error messages, version, and platform.

import pyarrow as pa
import pyarrow.compute as pc

from datetime import datetime, timezone
from zoneinfo import ZoneInfo

string = '2038-04-01 03:00:00.000000'

dt = datetime.fromisoformat(string)
dt = dt.replace(tzinfo=ZoneInfo('America/Boise'))
tz = ZoneInfo('UTC')
converted_dt = dt.astimezone(tz)
print(converted_dt)

ts = pc.assume_timezone(pa.array([datetime(2038, 4, 1, 3)]), timezone='America/Boise')
print(ts)

The above prints

2038-04-01 09:00:00+00:00
[
  2038-04-01 10:00:00.000000
]

whereas I was expecting

2038-04-01 09:00:00+00:00
[
  2038-04-01 09:00:00.000000
]

Note that it's correct for year 2037 and earlier.

Versions:

  • pyarrow: 12.0.0
  • python: 3.10.6

Component(s)

Python

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions