Skip to content
Snippets Groups Projects
Commit 25778f28 authored by Stefan Bernhard's avatar Stefan Bernhard Committed by Dirk Sarpe
Browse files

adapt formatting of date, timestamp string

parent c93f576a
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@ import os
url = 'https://portal.idiv.de/ssf/ical/basic.ics?bi=393&ui=1026&pd=171497477d81eb659bd832ffe26c8bfe39d65fc3&v=1'
tz = 'Europe/Berlin'
now = arrow.now(tz)
period = (now.floor('day'), now.replace(weeks=+2))
period = (now.floor('day'), now.replace(weeks=+52))
c = Calendar(requests.get(url).text)
......@@ -24,7 +24,7 @@ for e in c.events:
duration = e.end - e.begin
# short, full day and multi day events display datetime differently
if duration.days < 1:
event_date = (e.begin.format('DD.MM.YYYY HH:mm')
event_date = (e.begin.format('DD.MM.YYYY, HH:mm')
+ ' &ndash; '
+ e.end.format('HH:mm'))
elif duration.days == 1:
......@@ -34,8 +34,7 @@ for e in c.events:
corrected_end_date = e.end.replace(days = - 1)
event_date = (e.begin.format('DD.MM.YYYY')
+ ' &ndash; '
+ corrected_end_date.format('DD.MM.YYYY')
+ ', all day')
+ corrected_end_date.format('DD.MM.YYYY'))
else:
event_date = ''
# create list of dictionaries for jinja2 template
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment