Added support for UTC and DateTimeOffsets in VEVENT generator by codebude · Pull Request #499 · Shane32/QRCoder
Summary
Inspired by issue #458 and the discussion there, this PR extends the CalendarEvent payload generator with a UTC DateTime functionality.
This PR fixes the following problems:
- CalendarEvent took DateTime objects for start and end of event, but didn't care about DateTime.Kind or any offset
Details
- If plain DateTime objects (with DateTime.Kind.Unspecified) are passed to the payload generator nothing change, to avoid breaking changes
- If DateTime objects with DateTime.Kind.Utc are handed over, the payload generator will respect the UTC and save the dates as "UTC" in the iCal calendar event
- Another constructor overload is added that accepts DateTimeOffset instead of DateTime objects. Those will be converted to DateTime objects with Kind.Utc internally by use of the offset defined in the DateTimeOffset objects.
Test plan
Test cases were added to the PayloadGeneratorTests.cs
Closing issues
Fixes #458