diff --git a/calsocial/models.py b/calsocial/models.py index 3445ec6..6717e11 100644 --- a/calsocial/models.py +++ b/calsocial/models.py @@ -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'' diff --git a/calsocial/templates/month-view.html b/calsocial/templates/month-view.html index 1294b77..eee37ff 100644 --- a/calsocial/templates/month-view.html +++ b/calsocial/templates/month-view.html @@ -119,8 +119,7 @@ {{ day.day }} {% for event in calendar.day_events(day, user=current_user) %}
- {{ event.start_time_tz.strftime('%H:%M') }}–{{ event.end_time_tz.strftime('%H:%M') }} - ({{ event.time_zone }}) + {{ event.start_time_for_user(current_user).strftime('%H:%M') }}–{{ event.end_time_for_user(current_user).strftime('%H:%M') }} {{ event.title }}
{% endfor %}