Open martinthenext opened 7 years ago
Just did the first 3 items:
pytz.all_timzones
lists the string representations of all timezoneslondon_tz = pytz.timezone("Europe/London")
converts from a string representation to a timezone object. london_tz.zone
converts back to the string representationget_datetime_repr()
function in timezone_conversions.py
along with a very basic test (this is also just to get some tests set up which makes it easier to add more!)Merged this module into the dev
branch. I also renamed it timezone.py
(like Django's module), as time.py
clashed with the builtin time
module.
Currently, daytobase shows record time stamps in UTC. Instead, we have to query and record user's timezone and use it to:
#t 12:04 pm
) and output UTC time stampsLooks like PyMongo suggests we use pytz module. We need to:
get_datetime_repr(dt, user)
wheredt
is a UTC datetime anduser
in an object that has atimezone
field with a timezone string representation in it, that outputs a string representation ofdt
in the right timezone.get_time_tag(message, user)
wheremessage
is a text of a message, i.e. "ate a banana #t one hour ago", and outputs adatetime
object in UTC.For the latter, use cases we definitely need to handle:
#t one hour ago
#t 12:44
After that is done it would be nice to have at least some minor unittests for these functions.