Skip to content
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

fix: deal with "GMT" time zone in iCalendar files #8506

Merged
merged 2 commits into from
Feb 6, 2025
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
5 changes: 4 additions & 1 deletion ietf/doc/templatetags/ietf_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,14 @@ def ics_date_time(dt, tzname):
>>> ics_date_time(datetime.datetime(2022,1,2,3,4,5), 'UTC')
':20220102T030405Z'

>>> ics_date_time(datetime.datetime(2022,1,2,3,4,5), 'GmT')
':20220102T030405Z'

>>> ics_date_time(datetime.datetime(2022,1,2,3,4,5), 'America/Los_Angeles')
';TZID=America/Los_Angeles:20220102T030405'
"""
timestamp = dt.strftime('%Y%m%dT%H%M%S')
if tzname.lower() == 'utc':
if tzname.lower() in ('gmt', 'utc'):
return f':{timestamp}Z'
else:
return f';TZID={ics_esc(tzname)}:{timestamp}'
Expand Down
10 changes: 5 additions & 5 deletions ietf/templates/meeting/agenda.ics
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{% load humanize tz %}{% autoescape off %}{% timezone schedule.meeting.tz %}{% load ietf_filters textfilters %}{% load cache %}{% cache 1800 ietf_meeting_agenda_ics schedule.meeting.number request.path request.GET %}BEGIN:VCALENDAR
{% load humanize tz %}{% autoescape off %}{% timezone schedule.meeting.tz %}{% with tzname=schedule.meeting.time_zone|lower %}{% load ietf_filters textfilters %}{% load cache %}{% cache 1800 ietf_meeting_agenda_ics schedule.meeting.number request.path request.GET %}BEGIN:VCALENDAR
VERSION:2.0
METHOD:PUBLISH
PRODID:-//IETF//datatracker.ietf.org ical agenda//EN
{{schedule.meeting.vtimezone}}{% for item in assignments %}BEGIN:VEVENT
{% if tzname != "utc" and tzname != "gmt" %}{% firstof schedule.meeting.vtimezone "" %}{% endif %}{% for item in assignments %}BEGIN:VEVENT
UID:ietf-{{schedule.meeting.number}}-{{item.timeslot.pk}}-{{item.session.group.acronym}}
SUMMARY:{% if item.session.name %}{{item.session.name|ics_esc}}{% else %}{{item.session.group_at_the_time.acronym|lower}} - {{item.session.group_at_the_time.name}}{%endif%}{% if item.session.agenda_note %} ({{item.session.agenda_note}}){% endif %}
{% if item.timeslot.show_location %}LOCATION:{{item.timeslot.get_location}}
{% endif %}STATUS:{{item.session.ical_status}}
CLASS:PUBLIC
DTSTART{% ics_date_time item.timeslot.local_start_time schedule.meeting.time_zone %}
DTEND{% ics_date_time item.timeslot.local_end_time schedule.meeting.time_zone %}
DTSTART{% ics_date_time item.timeslot.local_start_time tzname %}
DTEND{% ics_date_time item.timeslot.local_end_time tzname %}
DTSTAMP{% ics_date_time item.timeslot.modified|utc 'utc' %}{% if item.session.agenda %}
URL:{{item.session.agenda.get_versionless_href}}{% endif %}
DESCRIPTION:{{item.timeslot.name|ics_esc}}\n{% if item.session.agenda_note %}
Expand All @@ -29,4 +29,4 @@ DESCRIPTION:{{item.timeslot.name|ics_esc}}\n{% if item.session.agenda_note %}
\n{# link agenda for ietf meetings #}
See in schedule: {% absurl 'agenda' num=schedule.meeting.number %}#row-{{ item.slug }}\n{% endif %}
END:VEVENT
{% endfor %}END:VCALENDAR{% endcache %}{% endtimezone %}{% endautoescape %}
{% endfor %}END:VCALENDAR{% endcache %}{% endwith %}{% endtimezone %}{% endautoescape %}
Loading