Skip to content

[FEATURE] Message.date is UTC-localized #3595

@Trifase

Description

@Trifase

Steps to Reproduce

Message.date is a datetime object created by PTB converting the original unix timestamp sent by telegram. It IS timezone aware, but uses UTC.

Expected behaviour

I fully expected that - because I've setup my local timezone using Default.tzinfo and passing it to ApplicationBuilder.defaults - the received Message.date would be localized in my local timezone.

Actual behaviour

This is not the case. AFAIK Default.tzinfo is only used to localize the datetime objects used for job_queue's jobs.

Operating System

Raspberry OS

Version of Python, python-telegram-bot & dependencies

python-telegram-bot 20.1
Bot API 6.5
Python 3.11.0 (main, Nov 23 2022, 10:42:54) [GCC 10.2.1 20210110]

Relevant log output

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions