Skip to content

Commit

Permalink
be less restrictive on timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjapiratica committed Jan 13, 2025
1 parent 09e7631 commit e5b58be
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
21 changes: 1 addition & 20 deletions NP.Lti13Platform.Core/Models/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,7 @@ public class User
/// <summary>
/// String from IANA Time Zone Database representing the user's time zone. For example, Europe/Paris or America/Los_Angeles.
/// </summary>
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; }

/// <summary>
/// User's locale, represented as a <see href="https://www.rfc-editor.org/rfc/rfc5646.txt">BCP47</see> 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.
Expand Down
2 changes: 1 addition & 1 deletion NP.Lti13Platform.Core/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit e5b58be

Please sign in to comment.