Skip to content
Draft
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
4 changes: 2 additions & 2 deletions Ical.Net.Tests/Calendars/Serialization/Duration1.ics
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ LAST-MODIFIED:20090202T114820Z
DTSTAMP:20090322T170116Z
UID:edb7a48a-d846-47f8-bad2-9ea3f29bcda5
SUMMARY:Vacances de la Toussaint
DTSTART;TZID=Europe/Paris;VALUE=DATE:20081025
DTEND;TZID=Europe/Paris;VALUE=DATE:20081106
DTSTART;VALUE=DATE:20081025
DTEND;VALUE=DATE:20081106
TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR
4 changes: 2 additions & 2 deletions Ical.Net.Tests/Calendars/Serialization/TimeZone3.ics
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ DTSTAMP:20080121T170940Z
UID:949ee027-7b13-4792-863b-73d9061b60f0
SUMMARY:Neujahr
RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTHDAY=1;BYMONTH=1
DTSTART;VALUE=DATE;TZID=/mozilla.org/20070129_1/Europe/Berlin:20080101
DTEND;VALUE=DATE;TZID=/mozilla.org/20070129_1/Europe/Berlin:20080102
DTSTART;VALUE=DATE:20080101
DTEND;VALUE=DATE:20080102
TRANSP:TRANSPARENT
BEGIN:VALARM
TRIGGER;VALUE=DURATION:-PT1H
Expand Down
13 changes: 12 additions & 1 deletion Ical.Net/Serialization/DataTypes/DateTimeSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,18 @@
}

var isUtc = match.Groups[9].Success;
if (isUtc) timeZoneId = "UTC";
if (timeZoneId != null)
{
if (isUtc)
throw new FormatException("A TZID mustn't be specified for a date with the 'Z' suffix.");

Check warning on line 108 in Ical.Net/Serialization/DataTypes/DateTimeSerializer.cs

View check run for this annotation

Codecov / codecov/patch

Ical.Net/Serialization/DataTypes/DateTimeSerializer.cs#L108

Added line #L108 was not covered by tests

if (!timePart.HasValue)
throw new FormatException("A TZID property mustn't be present for date-only values.");

Check warning on line 111 in Ical.Net/Serialization/DataTypes/DateTimeSerializer.cs

View check run for this annotation

Codecov / codecov/patch

Ical.Net/Serialization/DataTypes/DateTimeSerializer.cs#L111

Added line #L111 was not covered by tests
}

if (isUtc)
timeZoneId = "UTC";


var res = timePart.HasValue
? new CalDateTime(datePart, timePart.Value, timeZoneId)
Expand Down
Loading