Search Results for

    Show / Hide Table of Contents
    View Source

    Class JsonUniversalDateTimeConverter

    Converts a DateTime value to or from JSON, always converting the value to Coordinated Universal Time (UTC) when reading.

    Inheritance
    System.Object
    System.Text.Json.Serialization.JsonConverter
    System.Text.Json.Serialization.JsonConverter<DateTime>
    ReadOnlyJsonConverter<DateTime>
    Namespace: Umbraco.Cms.Infrastructure.Serialization
    Assembly: Umbraco.Infrastructure.dll
    Syntax
    public sealed class JsonUniversalDateTimeConverter : ReadOnlyJsonConverter<DateTime>
    Remarks

    In order to match the existing behaviour, and that of MessagePack, we need to ensure that DateTimes are always read as UTC. This is not the case by default for System.Text.Json, see: https://github.com/dotnet/runtime/issues/1566.

    Methods

    View Source

    Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

    Declaration
    public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
    Parameters
    Type Name Description
    System.Text.Json.Utf8JsonReader reader
    Type typeToConvert
    System.Text.Json.JsonSerializerOptions options
    Returns
    Type Description
    DateTime
    • Improve this Doc
    • View Source
    In This Article
    • Methods
      • Read(ref Utf8JsonReader, Type, JsonSerializerOptions)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX