Given an event that contains a DATE only value for DTSTART and DTEND, the event fields are set to nil. I initially thought having a plain date was against the spec as icalendar also had this issue but I found sections of the literature that seem to imply date-only is valid:
https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.2.4
Value Type: The default value type is DATE-TIME. The time value
MUST be one of the forms defined for the DATE-TIME value type.
The value type can be set to a DATE value type.
It also prescribes a case for this in VEVENT: https://datatracker.ietf.org/doc/html/rfc5545#section-3.6.1
For cases where a "VEVENT" calendar component
specifies a "DTSTART" property with a DATE value type but no
"DTEND" nor "DURATION" property, the event's duration is taken to
be one day.
Here is an example file that has this issue:
BEGIN:VCALENDAR
METHOD:PUBLISH
PRODID:ExampleProd
VERSION:2.0
X-WR-CALNAME:ExampleName
X-WR-TIMEZONE:America/Edmonton
BEGIN:VTIMEZONE
TZID:America/Edmonton
X-LIC-LOCATION:America/Edmonton
BEGIN:STANDARD
DTSTART:20241103T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11
TZNAME:MST
TZOFFSETFROM:-0600
TZOFFSETTO:-0700
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:20250309T020000
RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3
TZNAME:MDT
TZOFFSETFROM:-0700
TZOFFSETTO:-0600
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
CREATED;TZID=America/Edmonton:20260406T000000
DTEND;TZID=America/Edmonton;VALUE=DATE:20260530
DTSTAMP;TZID=America/Edmonton:20260406T000000
DTSTART;TZID=America/Edmonton;VALUE=DATE:20260529
SEQUENCE:2026052815
SUMMARY:ExampleSummary
UID:ExampleID
X-FUNAMBOL-ALLDAY:1
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
END:VEVENT
END:VCALENDAR
I'm not sure which library the ical is produced with, but judging by the data source it is ASP.net or similarly based, and the file is parsed correctly by Apple Calendar, as well as Microsoft Outlook.
Here is the resulting event:
%ICal.Event{
uid: "ExampleID",
dtstamp: #DateTime<2026-04-06 00:00:00-06:00 MDT America/Edmonton>,
created: #DateTime<2026-04-06 00:00:00-06:00 MDT America/Edmonton>,
dtstart: nil,
dtend: nil,
...
}
I did end up bodging this in our fork of icalender but the solution wasn't very nice (and used Timex):
case Timex.parse(date_string <> timezone, "{YYYY}{0M}{0D}Z{Zname}") do
{:ok, dt} -> {:ok, dt}
{:error, _} ->
Timex.parse(date_string <> timezone, "{YYYY}{0M}{0D}T{h24}{m}{s}Z{Zname}")
end
end
I'd be willing to implement something similar here with Calendar and parsing the value type unless there's something else I'm missing.
Given an event that contains a DATE only value for DTSTART and DTEND, the event fields are set to
nil. I initially thought having a plain date was against the spec asicalendaralso had this issue but I found sections of the literature that seem to imply date-only is valid:https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.2.4
It also prescribes a case for this in VEVENT: https://datatracker.ietf.org/doc/html/rfc5545#section-3.6.1
Here is an example file that has this issue:
I'm not sure which library the ical is produced with, but judging by the data source it is ASP.net or similarly based, and the file is parsed correctly by Apple Calendar, as well as Microsoft Outlook.
Here is the resulting event:
I did end up bodging this in our fork of
icalenderbut the solution wasn't very nice (and usedTimex):I'd be willing to implement something similar here with
Calendarand parsing the value type unless there's something else I'm missing.