-
Notifications
You must be signed in to change notification settings - Fork 7
Default to UTC timezone #116
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
Changes from 7 commits
a2c593a
95b8a7d
a4405a8
fa9a56c
765d473
e9fdbc6
00216b5
765a076
c5d4b82
344bdf0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,18 +52,20 @@ def gettz(tzname: str) -> datetime.tzinfo: | |
| # This function can be used to add a list of e.g. exception dates (EXDATE) or | ||
| # recurrence dates (RDATE) to a reoccurring event | ||
| def add_recurrence_property( | ||
| event: ics.Event, property_name, dates: map, tz: datetime.tzinfo = None | ||
| event: ics.Event, property_name, dates: map, tz: datetime.tzinfo = dateutil.tz.UTC | ||
| ): | ||
| event.extra.append( | ||
| ics.ContentLine( | ||
| name=property_name, | ||
| params={"TZID": [str(ics.Timezone.from_tzinfo(tz))]} if tz else None, | ||
| params={"TZID": [str(ics.Timezone.from_tzinfo(tz))]}, | ||
| value=",".join(dates), | ||
| ) | ||
| ) | ||
|
|
||
|
|
||
| def event_from_yaml(event_yaml: dict, tz: datetime.tzinfo = None) -> ics.Event: | ||
| def event_from_yaml( | ||
| event_yaml: dict, tz: datetime.tzinfo = dateutil.tz.UTC | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think either change the default, or change the handling below, but not both.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel it makes most sense to change the default here, and then let the event
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or, just break if the event_yaml does not have a timezone.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, after #125 this becomes the crux of the current PR. We should document this in the README. |
||
| ) -> ics.Event: | ||
| d = event_yaml | ||
| repeat = d.pop("repeat", None) | ||
| ics_custom = d.pop("ics", None) | ||
|
|
@@ -184,6 +186,8 @@ def files_to_events(files: list) -> (ics.Calendar, str): | |
| tz = calendar_yaml.get("timezone", None) | ||
| if tz is not None: | ||
| tz = gettz(tz) | ||
| else: | ||
|
bsipocz marked this conversation as resolved.
Outdated
|
||
| tz = dateutil.tz.UTC | ||
| if "include" in calendar_yaml: | ||
| included_events, _name = files_to_events( | ||
| os.path.join(os.path.dirname(f), newfile) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we make TZ required for now; this is for internal use anyway.