mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 03:11:54 +00:00
Some functions in models.py had input typed as int when they needed to be typed as datetime.datetime
14 lines
414 B
Python
14 lines
414 B
Python
from __future__ import absolute_import
|
|
|
|
import datetime
|
|
import calendar
|
|
from django.utils.timezone import utc
|
|
|
|
def timestamp_to_datetime(timestamp):
|
|
# type: (float) -> datetime.datetime
|
|
return datetime.datetime.utcfromtimestamp(float(timestamp)).replace(tzinfo=utc)
|
|
|
|
def datetime_to_timestamp(datetime_object):
|
|
# type: (datetime.datetime) -> int
|
|
return calendar.timegm(datetime_object.timetuple())
|