From e5b58be04fa1b674a46a8cff2a3604d8ceeac5f6 Mon Sep 17 00:00:00 2001 From: Chase Hanson Date: Sun, 12 Jan 2025 22:33:41 -0800 Subject: [PATCH] be less restrictive on timezone --- NP.Lti13Platform.Core/Models/User.cs | 21 +-------------------- NP.Lti13Platform.Core/Startup.cs | 2 +- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/NP.Lti13Platform.Core/Models/User.cs b/NP.Lti13Platform.Core/Models/User.cs index c757856..a28a2c6 100644 --- a/NP.Lti13Platform.Core/Models/User.cs +++ b/NP.Lti13Platform.Core/Models/User.cs @@ -73,26 +73,7 @@ public class User /// /// String from IANA Time Zone Database representing the user's time zone. For example, Europe/Paris or America/Los_Angeles. /// - public TimeZoneInfo? TimeZone - { - get => _timeZone; - set - { - if (value == null || value.HasIanaId) - { - _timeZone = value; - } - else if (TimeZoneInfo.TryConvertWindowsIdToIanaId(value.Id, out var ianaId)) - { - _timeZone = TimeZoneInfo.FindSystemTimeZoneById(ianaId); - } - else - { - throw new InvalidTimeZoneException("TimeZone must be an IANA time zone or convertible to an IANA time zone."); - } - } - } - private TimeZoneInfo? _timeZone; + public string? TimeZone { get; set; } /// /// User's locale, represented as a BCP47 language tag. This is typically a language code in lowercase and an country code in uppercase, separated by a dash. For example, en-US or fr-CA. As a compatibility note, some implementations have used an underscore as the separator rather than a dash, for example, en_US; MAY choose to accept this locale syntax as well. diff --git a/NP.Lti13Platform.Core/Startup.cs b/NP.Lti13Platform.Core/Startup.cs index 679ccb3..641c7f3 100644 --- a/NP.Lti13Platform.Core/Startup.cs +++ b/NP.Lti13Platform.Core/Startup.cs @@ -275,7 +275,7 @@ public static IEndpointRouteBuilder UseLti13PlatformCore(this IEndpointRouteBuil ltiMessage.Profile = userPermissions.Profile ? user.Profile?.ToString() : null; ltiMessage.UpdatedAt = userPermissions.UpdatedAt ? user.UpdatedAt : null; ltiMessage.Website = userPermissions.Website ? user.Website?.ToString() : null; - ltiMessage.TimeZone = userPermissions.TimeZone ? user.TimeZone?.Id : null; + ltiMessage.TimeZone = userPermissions.TimeZone ? user.TimeZone : null; } var scope = new MessageScope(