Fix single day events showing as two days on calendar
This commit is contained in:
parent
8a9bad4bba
commit
51139a1a70
|
@ -1,8 +1,8 @@
|
|||
"""Calendar."""
|
||||
|
||||
import typing
|
||||
from datetime import timedelta
|
||||
import uuid
|
||||
from datetime import timedelta
|
||||
|
||||
from .event import Event
|
||||
|
||||
|
@ -89,7 +89,15 @@ def build_toastui_events(events: list[Event]) -> list[dict[str, typing.Any]]:
|
|||
if e.has_time:
|
||||
end_iso = (e.end_date or e.date + timedelta(minutes=30)).isoformat()
|
||||
else:
|
||||
end_date = (e.end_as_date if e.end_date else e.as_date) + one_day
|
||||
# For all-day events, the end date is exclusive.
|
||||
# For a single-day event, the end date should be the same as the start date.
|
||||
# For a multi-day event, a day is added to make the range inclusive.
|
||||
if e.end_date:
|
||||
# This is a multi-day event, so add one day to the end.
|
||||
end_date = e.end_as_date + one_day
|
||||
else:
|
||||
# This is a single-day event. The end date is the same as the start date.
|
||||
end_date = e.as_date
|
||||
end_iso = end_date.isoformat()
|
||||
|
||||
item = {
|
||||
|
|
Loading…
Reference in a new issue