forked from gergely/calendar-social
Display event timestamps in the current user’s time zone
This commit is contained in:
@@ -197,6 +197,18 @@ class Event(db.Model):
|
||||
|
||||
return self.__as_tz(self.end_time)
|
||||
|
||||
def start_time_for_user(self, user):
|
||||
"""The same timestamp as `start_time`, but in the time zone of `user`
|
||||
"""
|
||||
|
||||
return self.__as_tz(self.start_time, as_timezone=user.timezone)
|
||||
|
||||
def end_time_for_user(self, user):
|
||||
"""The same timestamp as `end_time`, but in the time zone of `user`
|
||||
"""
|
||||
|
||||
return self.__as_tz(self.end_time, as_timezone=user.timezone)
|
||||
|
||||
def __repr__(self):
|
||||
return f'<Event {self.id} ({self.title}) of {self.user}>'
|
||||
|
||||
|
Reference in New Issue
Block a user