-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Add tz kwarg to from_timestamp() #1621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
With this the default is an aware python-telegram-bot/telegram/message.py Line 355 in 9344944
data['date'] = from_timestamp(data['date']).replace(tzinfo=None) . Or the default for from_timestamp could be kept as naive UTC to avoid the breaking change.
Otherwise I think the only problem is handling if tzinfo is not None:
return dtm.datetime.fromtimestamp(unixtime, tz=tzinfo)
else:
return dtm.datetime.utcfromtimestamp(unixtime) |
Good point. Let's wait, what tsoam says.
Oh, shuh, you're absolutely right. Will update tonight. |
Updated as suggested. About the failing tests:
|
agree with the 2.7 part |
@plammens Lost in translation … Thanks for clarifying! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one minor comment on a docstring. but LGTM, you can merge.
actually, i just fixed the docstring myself. you can merge from master and then you can merge this PR. |
# Conflicts: # tests/conftest.py
Closing #1613 as addendum to #1506
@tsnoam @plammens Is this, what was missing or am I overlooking half of it? :D