aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2024-01-06 15:01:50 -0700
committerCody Robibero <cody@robibe.ro>2024-01-06 15:01:54 -0700
commitf2b01f66e88d22f11c6530c085eda002ceb175dd (patch)
tree4fc84a90d99f1b7975ddc9c0892f6732a2786bed
parentf49de51225b2206609df6a89f3cbb5fd7459ff68 (diff)
Specify DateTimeKind when pulling a DateTime out of the database
-rw-r--r--Emby.Server.Implementations/Data/SqliteExtensions.cs7
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;
}