mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-17 05:00:24 +01:00
Merge pull request #4580 from crobibero/efcore-datetime
Specify default DateTimeKind from EFCore
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace MediaBrowser.Common.Json.Converters
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns an ISO8601 formatted datetime.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Used for legacy compatibility.
|
||||
/// </remarks>
|
||||
public class JsonDateTimeIso8601Converter : JsonConverter<DateTime>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
=> reader.GetDateTime();
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options)
|
||||
=> writer.WriteStringValue(value.ToString("O", CultureInfo.InvariantCulture));
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,6 @@ namespace MediaBrowser.Common.Json
|
||||
options.Converters.Add(new JsonVersionConverter());
|
||||
options.Converters.Add(new JsonStringEnumConverter());
|
||||
options.Converters.Add(new JsonNullableStructConverterFactory());
|
||||
options.Converters.Add(new JsonDateTimeIso8601Converter());
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user