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 ...@@ -12,7 +12,7 @@ import os
url = 'https://portal.idiv.de/ssf/ical/basic.ics?bi=393&ui=1026&pd=171497477d81eb659bd832ffe26c8bfe39d65fc3&v=1' url = 'https://portal.idiv.de/ssf/ical/basic.ics?bi=393&ui=1026&pd=171497477d81eb659bd832ffe26c8bfe39d65fc3&v=1'
tz = 'Europe/Berlin' tz = 'Europe/Berlin'
now = arrow.now(tz) 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) c = Calendar(requests.get(url).text)
...@@ -24,7 +24,7 @@ for e in c.events: ...@@ -24,7 +24,7 @@ for e in c.events:
duration = e.end - e.begin duration = e.end - e.begin
# short, full day and multi day events display datetime differently # short, full day and multi day events display datetime differently
if duration.days < 1: 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; ' + ' &ndash; '
+ e.end.format('HH:mm')) + e.end.format('HH:mm'))
elif duration.days == 1: elif duration.days == 1:
...@@ -34,8 +34,7 @@ for e in c.events: ...@@ -34,8 +34,7 @@ for e in c.events:
corrected_end_date = e.end.replace(days = - 1) corrected_end_date = e.end.replace(days = - 1)
event_date = (e.begin.format('DD.MM.YYYY') event_date = (e.begin.format('DD.MM.YYYY')
+ ' &ndash; ' + ' &ndash; '
+ corrected_end_date.format('DD.MM.YYYY') + corrected_end_date.format('DD.MM.YYYY'))
+ ', all day')
else: else:
event_date = '' event_date = ''
# create list of dictionaries for jinja2 template # 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