Skip to content
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

Use UTC dates #1362

Closed
Lonami opened this issue Mar 14, 2019 · 2 comments · Fixed by #1485
Closed

Use UTC dates #1362

Lonami opened this issue Mar 14, 2019 · 2 comments · Fixed by #1485
Labels

Comments

@Lonami
Copy link

Lonami commented Mar 14, 2019

def from_timestamp(unixtime):
"""
Args:
unixtime (int):
Returns:
datetime.datetime:
"""
if not unixtime:
return None
return datetime.fromtimestamp(unixtime)

Should probably be using tz=timezone.utc. Python's datetime isn't the best, and fromtimestamp by default sets no tz information, which uses the local time, which in turn is generally a bad idea.

Copy link
Member

@Lonami I guess we all agree it should be UTC, but it is a breaking change. Maybe we can get it in before official v12 release?

@PaulSonOfLars
Copy link
Contributor

I agree, since there's a breaking change spree for v12, might as well add this in

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants