Show time and timezone in separate columns
This commit is contained in:
parent
a9cad3c749
commit
ec1694fc84
|
@ -32,6 +32,24 @@ class Event:
|
||||||
self.date.date() if isinstance(self.date, datetime.datetime) else self.date
|
self.date.date() if isinstance(self.date, datetime.datetime) else self.date
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def display_time(self) -> str | None:
|
||||||
|
"""Time for display on web page."""
|
||||||
|
return (
|
||||||
|
self.date.strftime("%H:%M")
|
||||||
|
if isinstance(self.date, datetime.datetime)
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def display_timezone(self) -> str | None:
|
||||||
|
"""Timezone for display on web page."""
|
||||||
|
return (
|
||||||
|
self.date.strftime("%z")
|
||||||
|
if isinstance(self.date, datetime.datetime)
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
|
||||||
def delta_days(self, today: datetime.date) -> str:
|
def delta_days(self, today: datetime.date) -> str:
|
||||||
"""Return number of days from today as a string."""
|
"""Return number of days from today as a string."""
|
||||||
delta = (self.as_date - today).days
|
delta = (self.as_date - today).days
|
||||||
|
|
|
@ -61,8 +61,15 @@
|
||||||
{% for event in events %}
|
{% for event in events %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-end">
|
<td class="text-end">
|
||||||
{{event.display_date}}
|
{{event.as_date.strftime("%a, %d, %b %Y")}}
|
||||||
</td>
|
</td>
|
||||||
|
<td class="text-end">
|
||||||
|
{{event.display_time or ""}}
|
||||||
|
</td>
|
||||||
|
<td class="text-end">
|
||||||
|
{{event.display_timezone or ""}}
|
||||||
|
</td>
|
||||||
|
|
||||||
<td class="text-start {% if event.name in class_map %} {{ class_map[event.name]}}{% endif %}">
|
<td class="text-start {% if event.name in class_map %} {{ class_map[event.name]}}{% endif %}">
|
||||||
{% if event.url %}<a href="{{ event.url }}">{% endif %}
|
{% if event.url %}<a href="{{ event.url }}">{% endif %}
|
||||||
{{ event_labels.get(event.name) or event.name }}
|
{{ event_labels.get(event.name) or event.name }}
|
||||||
|
|
Loading…
Reference in a new issue