Skip to content

Commit

Permalink
feat(views.py): implemented better date presentation for multi day ev…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
Hetti committed Sep 22, 2023
1 parent e07ab15 commit 4db1f6b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def formatday(self, day, weekday):
if day != 0:
# self.year and self.month are set as a side-effect of formatmonth()
this_day = date(self.year, self.month, day)

next_day = this_day + relativedelta.relativedelta(days=1)
cssclass = self.cssclasses[weekday]
if date.today() == this_day:
Expand All @@ -46,8 +47,11 @@ def formatday(self, day, weekday):
if self.admin:
body.append(u'<a href="%s" class="edit" title="edit">✏️</a>' % event.get_absolute_url())
body.append('<a href="/wiki/%s">' % event.wikiPage)
body.append('<span class="event-time">' + event.startDate.strftime('%H:%M') + '</span>')
if (this_day == event.startDate.date()):
body.append('<span class="event-time">' + event.startDate.strftime('%H:%M') + '</span>')
body.append('<span class="event-name">' + esc(event.name) + '</span>')
if (event.endDate) and (event.startDate.date() != event.endDate.date()) and (this_day == event.endDate.date()):
body.append(' <span class="event-time">' + event.endDate.strftime('%H:%M') + '</span>')
body.append('<span class="event-location">' + esc(event.location) + '</span>')
body.append('</a>')
body.append('</li>')
Expand Down

0 comments on commit 4db1f6b

Please sign in to comment.