Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix all day events bleeding over to following day: #407

Merged
merged 3 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions backend/src/appointment/controller/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,19 @@ def list_events(self, start, end):
# Mark tentative events
tentative = status == "tentative"

title = e.vobject_instance.vevent.summary.value
start = e.vobject_instance.vevent.dtstart.value
# get_duration grabs either end or duration into a timedelta
end = start + e.get_duration()
# if start doesn't hold time information (no datetime), it's a whole day
all_day = not isinstance(start, datetime)

events.append(
schemas.Event(
title=e.vobject_instance.vevent.summary.value,
start=e.vobject_instance.vevent.dtstart.value,
end=e.vobject_instance.vevent.dtend.value,
all_day=not isinstance(e.vobject_instance.vevent.dtstart.value, datetime),
title=title,
start=start,
end=end,
all_day=all_day,
tentative=tentative,
description=e.icalendar_component["description"] if "description" in e.icalendar_component else "",
)
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/CalendarQalendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const calendarEvents = computed(() => {
? start.format(dateFormatStrings.qalendarFullDay)
: start.format(dateFormatStrings.qalendar),
end: event.all_day
? end.format(dateFormatStrings.qalendarFullDay)
? end.subtract(1, 'minute').format(dateFormatStrings.qalendarFullDay)
: end.format(dateFormatStrings.qalendar),
},
description: event.description,
Expand Down