Skip to content

Commit

Permalink
fix: fix ics time format for tz=GMT
Browse files Browse the repository at this point in the history
  • Loading branch information
jennifer-richards committed Feb 6, 2025
1 parent f5c00fa commit 3740bf3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
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
{% firstof 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 %}

0 comments on commit 3740bf3

Please sign in to comment.