Skip to content
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "yaml2ics"
version = "0.3rc1.dev0"
requires-python = ">=3.8"
requires-python = ">=3.9"
authors = [{name = "Scientific Python Developers"}]
readme = "README.md"
license = {file = "LICENSE"}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import datetime
import io
import os
import zoneinfo

import pytest
import zoneinfo

from yaml2ics import event_from_yaml, files_to_events, main

Expand Down
6 changes: 5 additions & 1 deletion yaml2ics.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import datetime
import os
import sys
import zoneinfo

import dateutil
import dateutil.rrule
import ics
import yaml
import zoneinfo
from dateutil.tz import gettz as _gettz

interval_type = {
Expand Down Expand Up @@ -70,6 +70,7 @@ def event_from_yaml(event_yaml: dict, tz: datetime.tzinfo = None) -> ics.Event:

if tz is None:
tz = dateutil.tz.UTC

if "timezone" in d:
tzname = d.pop("timezone")
tz = gettz(tzname)
Expand All @@ -95,6 +96,9 @@ def event_from_yaml(event_yaml: dict, tz: datetime.tzinfo = None) -> ics.Event:
# or it was inferred from event start time.
tz = event.timespan.begin_time.tzinfo

if not tz:
tz = dateutil.tz.UTC

# Handle all-day events
if not ("duration" in d or "end" in d):
event.make_all_day()
Expand Down
Loading