diff options
| author | Bond_009 <bond.009@outlook.com> | 2021-06-19 18:02:33 +0200 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2021-06-19 18:04:46 +0200 |
| commit | 6f8ccab788e85e025eaa44b67a1487bf419afb53 (patch) | |
| tree | f8895fae8ec17e922daab473180c9de9a702a02a /MediaBrowser.Common/Json/Converters/JsonDateTimeConverter.cs | |
| parent | 0c3dcdf77b0d124517bffa608bfddf7d8f7682db (diff) | |
Move non-jellyfin extensions to separate project
Diffstat (limited to 'MediaBrowser.Common/Json/Converters/JsonDateTimeConverter.cs')
| -rw-r--r-- | MediaBrowser.Common/Json/Converters/JsonDateTimeConverter.cs | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/MediaBrowser.Common/Json/Converters/JsonDateTimeConverter.cs b/MediaBrowser.Common/Json/Converters/JsonDateTimeConverter.cs deleted file mode 100644 index 73e3a0493..000000000 --- a/MediaBrowser.Common/Json/Converters/JsonDateTimeConverter.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Globalization; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace MediaBrowser.Common.Json.Converters -{ - /// <summary> - /// Legacy DateTime converter. - /// Milliseconds aren't output if zero by default. - /// </summary> - public class JsonDateTimeConverter : JsonConverter<DateTime> - { - /// <inheritdoc /> - public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - return reader.GetDateTime(); - } - - /// <inheritdoc /> - public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) - { - if (value.Millisecond == 0) - { - // Remaining ticks value will be 0, manually format. - writer.WriteStringValue(value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffZ", CultureInfo.InvariantCulture)); - } - else - { - writer.WriteStringValue(value); - } - } - } -}
\ No newline at end of file |
