Add proper time zone support

Until now event timestamps were saved in the server’s time zone.  Now they are saved in UTC,
considering the time zone set by the creator of the event.
This commit is contained in:
2018-07-02 15:07:53 +02:00
parent 26c31bcc04
commit 8a46f3c66a
3 changed files with 95 additions and 3 deletions

View File

@@ -6,6 +6,7 @@
table.calendar {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
}
tr.month > td {
@@ -46,14 +47,31 @@
background-color: #d8d8d8;
}
td > div.event {
tr.week > td > div.event {
border: 1px solid green;
background-color: white;
border-radius: 2px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
tr.sizer > td {
width: 14.2857%;
height: 0;
}
</style>
<table class="calendar">
<thead>
<tr class="sizer">
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="month">
<td>
<a href="{{ url_for('hello', date=calendar.prev_year) }}">« {{ calendar.prev_year_year }}</a>
@@ -101,6 +119,8 @@
<span class="day-num">{{ day.day }}</span>
{% for event in calendar.day_events(day, user=current_user) %}
<div class="event">
{{ event.start_time_tz.strftime('%H:%M') }}{{ event.end_time_tz.strftime('%H:%M') }}
({{ event.time_zone }})
{{ event.title }}
</div>
{% endfor %}