Skip to content

Commit

Permalink
Add date/time converters to StaticSerializerBuilder.
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnherreman committed Sep 20, 2023
1 parent 6111db3 commit 03bf14e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions YamlDotNet/Serialization/StaticSerializerBuilder.cs
Expand Up @@ -340,6 +340,11 @@ public StaticSerializerBuilder JsonCompatible()

return this
.WithTypeConverter(new GuidConverter(true), w => w.InsteadOf<GuidConverter>())
.WithTypeConverter(new DateTimeConverter(doubleQuotes: true))
#if NET6_0_OR_GREATER
.WithTypeConverter(new DateOnlyConverter(doubleQuotes: true))
.WithTypeConverter(new TimeOnlyConverter(doubleQuotes: true))
#endif
.WithEventEmitter(inner => new JsonEventEmitter(inner, yamlFormatter), loc => loc.InsteadOf<TypeAssigningEventEmitter>());
}

Expand Down

0 comments on commit 03bf14e

Please sign in to comment.