.Net Calendar API Time Zone Difficulties

21 views
Skip to first unread message

Saro Marcarian

unread,
Jul 22, 2019, 3:01:38 PM7/22/19
to Google Calendar API
So according to the docs, if I assign no time zone to the start & end times of an event, the times should feault to the targeted calendar's time zone.

So I'm creating an event at 12:00.  I'm in the Pacific time zone - "America/Los_Angeles".  The calendar in question is "America/Chicago"  When I bring up the calendar, the entry created is at 12:00 UTC-7 (Daylight Savings Time in LA).  Should be showing up either as 10:00 in UTC-7 or 12:00 in UTC-5 (Chicago).  I also tried explicitly setting the time zone to America/Chicago with the same results.

Any thoughts?

Saro Marcarian

unread,
Jul 22, 2019, 3:19:04 PM7/22/19
to Google Calendar API
feault = default....

Saro Marcarian

unread,
Jul 23, 2019, 1:54:40 PM7/23/19
to Google Calendar API
Update:

I was passing a .Net DateTime to each of the Event's EventDateTime (Start and End) objects.  The .Net DateTime was carrying my localized time zone with it.

So, I tried DateTime.ToString("yyyy-MM-ddTHH:mm:ss").  Great!  I've now managed to make sure the time zone doesn't get populated.  Setting the TimeZone property now results in appropriate results.

Next, I want to pass a null or empty time zone so that the Calendar's default time zone is used.  So I tried null and I tried "".  In both cases, I get:

<error>
Google.GoogleApiException
  HResult=0x80131500
  Message=Google.Apis.Requests.RequestError
Missing time zone definition for start time. [400]
Errors [
Message[Missing time zone definition for start time.] Location[ - ] Reason[required] Domain[global]
Message[Missing time zone definition for end time.] Location[ - ] Reason[required] Domain[global]
]

  Source=Google.Apis
  StackTrace:
   at Google.Apis.Requests.ClientServiceRequest`1.<ParseResponse>d__31.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Google.Apis.Requests.ClientServiceRequest`1.Execute()
   at RPSGoogleCalendarHelper.CalendarHelper.CreateCalendarEntry(String ApplicationName, String CalendarID, String ClientSecrets, String CredentialWriteablePath, Boolean CredentialPathIsFullPath, Boolean TryUpsert, String ICalUID, String ID, List`1 Attendees, String Summary, String Description, String TimeZone, DateTime StartDateTime, DateTime EndDateTime, String Address) in C:\Users\Saro\git\RPSInteropUtils\RPSGoogleCalendarHelper\CalendarHelper.cs:line 343
   at RPSGoogleCalendarHelper.CalendarHelper.CreateCalendarEntry(String ApplicationName, String CalendarID, String ClientSecrets, String CredentialWriteablePath, Boolean CredentialPathIsFullPath, Boolean TryUpsert, String ICalUID, String ID, String AttendeeEmailAddressesDelimited, String Summary, String Description, String TimeZone, DateTime StartDateTime, DateTime EndDateTime, String Address, String Delimiter) in C:\Users\Saro\git\RPSInteropUtils\RPSGoogleCalendarHelper\CalendarHelper.cs:line 186
</error>

I've had to resort to storing time zones for each calendar I'm working with - but this seems to go against what the API docs say is required.
Reply all
Reply to author
Forward
0 new messages