diff --git a/tests/test_calendar.py b/tests/test_calendar.py index 3240f5b..d720a91 100644 --- a/tests/test_calendar.py +++ b/tests/test_calendar.py @@ -45,6 +45,9 @@ def test_calendar_default_timezone(): - summary: February 1 begin: 2022-02-01 00:00:00 +02:00 duration: {hours: 1} + + - summary: Earth day (all day) + begin: 2022-04-22 ''' ))] ) diff --git a/tests/test_events.py b/tests/test_events.py index 39efe57..7dfbc77 100644 --- a/tests/test_events.py +++ b/tests/test_events.py @@ -60,7 +60,8 @@ def test_rrule(): ) ) event_str = event.serialize() - assert 'DTEND' not in event_str + # DTEND exists and is the next day, calendar tools import this + # correctly as being a one-day event assert 'RRULE:FREQ=YEARLY;UNTIL=20300422T000000' in event_str diff --git a/yaml2ics.py b/yaml2ics.py index 54df116..3481594 100644 --- a/yaml2ics.py +++ b/yaml2ics.py @@ -75,7 +75,7 @@ def event_from_yaml(event_yaml: dict, tz: tzinfo=None) -> ics.Event: )) event.dtstamp = datetime.utcnow().replace(tzinfo=dateutil.tz.UTC) - if tz and event.floating: + if tz and event.floating and not event.all_day: event.replace_timezone(tz) return event