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

Timezone ignored when using specific Start/End overload on UpsertEventRequestBuilder #78

Open
kjlibsol opened this issue Nov 4, 2019 · 1 comment

Comments

@kjlibsol
Copy link

kjlibsol commented Nov 4, 2019

var cronofy = new CronofyAccountClient("xxxxxxxxxx");
string calendarId = "yyyyyyyyyyyyy";

var eventBuilder1 = new UpsertEventRequestBuilder()
    .EventId(Guid.NewGuid().ToString())
    .Summary("Cancun 17-18 | " + DateTime.Now.ToLongTimeString())
    .Description("Event description")
    .Start(2019, 11, 04, 17, 00)
    .End(2019, 11, 04, 18, 00)
    .TimeZoneId("America/Cancun");

var eventBuilder2 = new UpsertEventRequestBuilder()
    .EventId(Guid.NewGuid().ToString())
    .Summary("Malta 17-18 | " + DateTime.Now.ToLongTimeString())
    .Description("Event description")
    .Start(2019, 11, 04, 17, 00)
    .End(2019, 11, 04, 18, 00)
    .TimeZoneId("Europe/Malta");

cronofy.UpsertEvent(calendarId, eventBuilder1);
cronofy.UpsertEvent(calendarId, eventBuilder2);

I would expect this to create appointments at the specified time in the specified timezones - but it seems anything you enter in this overload of start/end is interpreted as UTC time, because this is how they show up in my calendar:

image

Using DateTime for start and end does not have the same issue.

@kjlibsol
Copy link
Author

kjlibsol commented Nov 4, 2019

It seems this is actually "by design", and the reason it works when supplying a datetime is because that is implicitly a local time (unless you explicitly set Kind).

https://docs.cronofy.com/developers/calendars-events/time-zones/#creating-and-updating-calendar-events

I kind of understand why you would make that design-choice, but I still find it counter-intuitive in the C# SDK, especially since it is not mentioned in the intellisense. :)

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

No branches or pull requests

1 participant