Skip to content

Serializing & Deserializing DateTime objects #2

Description

@pipermatt

The JsConfig object contains a flag called AssumeUtc. This flag causes the DateTimeSerializer to convert dates that are DateTimeKind.Unspecified on serialization to DateTimeKind.Utc using:

        if (JsConfig.AssumeUtc && dateTime.Kind == DateTimeKind.Unspecified)
        {
            dateTime = DateTime.SpecifyKind(dateTime, DateTimeKind.Utc);
        }

(lines 544-547 of NServiceKit.Text.Common.DateTimeSerializer)
However, deserialization ignores this flag and assumes that DateTimeKind.Unspecified should actually be DateTimeKind.Local.

Wouldn't it be preferable to have both serialization and deserialization honor this flag?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions