diff options
| author | Bond-009 <bond.009@outlook.com> | 2024-01-07 13:44:04 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-07 13:44:04 +0100 |
| commit | 89a0739d98f8edb87afb4a17bc6e795cab7438b7 (patch) | |
| tree | 67e7cead6b10d7d50313ad7fc5a37c0bd074a143 | |
| parent | 71ae715b3b2a4d968efee6c8fcc80dc398684a59 (diff) | |
| parent | f2b01f66e88d22f11c6530c085eda002ceb175dd (diff) | |
Merge pull request #10823 from crobibero/date-time-utc
Specify DateTimeKind when pulling a DateTime out of the database
| -rw-r--r-- | Emby.Server.Implementations/Data/SqliteExtensions.cs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Data/SqliteExtensions.cs b/Emby.Server.Implementations/Data/SqliteExtensions.cs index 01b5fdaee..25ef57d27 100644 --- a/Emby.Server.Implementations/Data/SqliteExtensions.cs +++ b/Emby.Server.Implementations/Data/SqliteExtensions.cs @@ -104,6 +104,13 @@ namespace Emby.Server.Implementations.Data if (DateTime.TryParseExact(dateText, _datetimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AdjustToUniversal, out var dateTimeResult)) { + // If the resulting DateTimeKind is Unspecified it is actually Utc. + // This is required downstream for the Json serializer. + if (dateTimeResult.Kind == DateTimeKind.Unspecified) + { + dateTimeResult = DateTime.SpecifyKind(dateTimeResult, DateTimeKind.Utc); + } + result = dateTimeResult; return true; } |
