Skip to content

Naive datetime should be treated as local timezone. UTC datetimes should be timezone aware. #1658

@n5y

Description

@n5y

Caused by #1506(#1505) #1485(#1362)

I believe local timezone is the expected default for naive datetime objects. Breaking those expectations will lead to unnecessary surprises for the users. It will also lead to awkward conversions if another library that does follow this convention is used.

Python's datetime.fromtimestamp and datetime.astimezone assume local timezone for naive objects. There are three warnings in datetime docs that start with "Because naive datetime objects are treated by many datetime methods as local times, it is preferred to use aware datetimes to represent times in UTC."

Using utc time is surely more sane than using local time, but the better way to do that is timezone aware datetimes, not naive-utc datetimes. For example Message.date should be timezone aware.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions