UTC Timezone shouldn't use TZID=UTC;
davidr64 opened this issue · comments
According to this documentation
https://icalendar.org/iCalendar-RFC-5545/3-2-19-time-zone-identifier.html
https://icalendar.org/iCalendar-RFC-5545/3-3-5-date-time.html
TZID shouldn't be used with UTC instead the value should end in a 'Z'
Code like this
e.dtstart = Icalendar::Values::DateTime.new(start_at.utc, 'tzid' => "UTC")
e.dtend = Icalendar::Values::DateTime.new(end_at.utc, 'tzid' => "UTC")
generates this
DTSTART;TZID=UTC;VALUE=DATE:20230820
DTEND;TZID=UTC;VALUE=DATE:20230821
Which could be my mistake but I would assume the library would handle that for me. However it looks like if I were to provide a formatted date that ended in a Z the DateTime initializer would automatically add tzid UTC.
https://github.com/icalendar/icalendar/blob/v2.5.2/lib/icalendar/values/date_time.rb#L14
The output of dtstart
and dtend
looks like they are dates, rather than date times. Dates don't have a concept of timezones so the TZID
is just an unknown param that gets passed through.
This code outputs the datetime with the correct Z
appended:
t = Icalendar::Values::DateTime.new Time.now.utc, 'tzid' => 'UTC'
t.value_ical
"20230905T204403Z"
Can you share more about the context where you're seeing this issue?
Cleaning up abandoned issues. Please re-open if this is still something to look at.