Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for UTC and DateTimeOffsets in VEVENT generator #499

Merged
merged 2 commits into from Apr 24, 2024

Conversation

codebude
Copy link
Owner

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

@codebude
Copy link
Owner Author

@Shane32 I would be happy if you could review the changes. I'm not sure if I got all of your points from our discussion in #458.

Offtopic: Once more I think timezones are madness... https://www.youtube.com/watch?v=-5wpm-gesOY

@codebude
Copy link
Owner Author

Copy link
Contributor

@Shane32 Shane32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Minor tweak noted. Great video too!

Co-authored-by: Shane Krueger <shane@acdmail.com>
@codebude codebude merged commit 8e226f2 into master Apr 24, 2024
3 checks passed
@codebude codebude deleted the feature/enhance-datetime-handling-in-ical-generator branch April 24, 2024 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Time Zone in Calendar events
2 participants