Skip to content

datetime.astimezone() returns DST name for negative timestamp on Windows #148658

@ynkdir

Description

@ynkdir

Bug report

Bug description:

PS C:\Users\yukih\Downloads> .\python-3.15.0a8-embed-amd64\python.exe
WARN: Could not find the platform standard library directory! The Python 'home' directory was set to 'C:\\Users\\yukih\\Downloads\\python-3.15.0a8-embed-amd64', is this correct?
Python 3.15.0a8 (tags/v3.15.0a8:55ea59e, Apr  7 2026, 14:21:25) [MSC v.1950 64 bit (AMD64)] on win32
>>> from datetime import datetime
>>>
>>> datetime.fromtimestamp(-1).astimezone()
datetime.datetime(1970, 1, 1, 8, 59, 59, tzinfo=datetime.timezone(datetime.timedelta(seconds=32400), 'Tokyo Daylight Time'))
>>>
>>> datetime.fromtimestamp(0).astimezone()
datetime.datetime(1970, 1, 1, 9, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=32400), 'Tokyo Standard Time'))

I expected "Tokyo Standard Time".

CPython versions tested on:

3.15

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowsinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions