Handling of all day events and auto calendar sync on account creation.
This commit is contained in:
@@ -180,6 +180,31 @@ public static class GoogleIntegratorExtensions
|
||||
return null;
|
||||
}
|
||||
|
||||
public static DateTime? GetEventLocalDateTime(EventDateTime calendarEvent)
|
||||
{
|
||||
if (calendarEvent == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (calendarEvent.DateTimeDateTimeOffset != null)
|
||||
{
|
||||
return DateTime.SpecifyKind(calendarEvent.DateTimeDateTimeOffset.Value.DateTime, DateTimeKind.Unspecified);
|
||||
}
|
||||
|
||||
if (calendarEvent.Date != null)
|
||||
{
|
||||
if (DateTime.TryParse(calendarEvent.Date, out DateTime eventDateTime))
|
||||
{
|
||||
return DateTime.SpecifyKind(eventDateTime, DateTimeKind.Unspecified);
|
||||
}
|
||||
|
||||
throw new Exception("Invalid date format in Google Calendar event date.");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extracts the timezone string from EventDateTime.
|
||||
/// Returns null for all-day events or if timezone is not specified.
|
||||
|
||||
@@ -335,6 +335,21 @@ public static class OutlookIntegratorExtensions
|
||||
}
|
||||
}
|
||||
|
||||
public static DateTime GetLocalDateTimeFromDateTimeTimeZone(DateTimeTimeZone dateTimeTimeZone)
|
||||
{
|
||||
if (dateTimeTimeZone == null || string.IsNullOrEmpty(dateTimeTimeZone.DateTime))
|
||||
{
|
||||
throw new ArgumentException("DateTimeTimeZone or DateTime is null or empty.");
|
||||
}
|
||||
|
||||
if (!DateTime.TryParse(dateTimeTimeZone.DateTime, out DateTime parsedDateTime))
|
||||
{
|
||||
throw new ArgumentException("DateTime string is not in a valid format.");
|
||||
}
|
||||
|
||||
return DateTime.SpecifyKind(parsedDateTime, DateTimeKind.Unspecified);
|
||||
}
|
||||
|
||||
private static AttendeeStatus GetAttendeeStatus(ResponseType? responseType)
|
||||
{
|
||||
return responseType switch
|
||||
|
||||
Reference in New Issue
Block a user