Skip to content

Commit 68ec495

Browse files
committed
Don't replace timezone of all day events
- This fails as defined by ics-py (you would think that event.floating would handle this, but apparently not). - Also add a test for this
1 parent ea66cd8 commit 68ec495

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

tests/test_calendar.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ def test_calendar_default_timezone():
4545
- summary: February 1
4646
begin: 2022-02-01 00:00:00 +02:00
4747
duration: {hours: 1}
48+
49+
- summary: Earth day (all day)
50+
begin: 2022-04-22
4851
'''
4952
))]
5053
)

yaml2ics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def event_from_yaml(event_yaml: dict, tz: tzinfo=None) -> ics.Event:
7575
))
7676

7777
event.dtstamp = datetime.utcnow().replace(tzinfo=dateutil.tz.UTC)
78-
if tz and event.floating:
78+
if tz and event.floating and not event.all_day:
7979
event.replace_timezone(tz)
8080
return event
8181

0 commit comments

Comments
 (0)