Skip to content

Commit

Permalink
Fixed date madness in .NET Framework
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasherceg committed Nov 3, 2024
1 parent 78bfbdd commit e3e7d53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private JsonSerializerOptions CreateSettings()
new DotvvmCustomPrimitiveTypeConverter(),
#if !DotNetCore
new DotvvmTimeOnlyJsonConverter(),
new DotvvmDateTimeConverter(),
new DotvvmDateOnlyJsonConverter(),
#endif
},
NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals,
Expand Down
5 changes: 5 additions & 0 deletions src/Tests/ViewModel/SerializerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,13 @@ public void SupportsDateTime_MicrosecondPrecision()
Assert.AreEqual(obj.TimeOnly, obj2.TimeOnly);
Assert.AreEqual(obj.TimeOnly.Ticks, obj2.TimeOnly.Ticks);

#if DotNetCore
Assert.AreEqual("2000-01-02T15:16:17.123456", json["DateTime1"].GetValue<string>());
Assert.AreEqual("15:16:17.1234560", json["TimeOnly"].GetValue<string>());
#else
Assert.AreEqual("2000-01-02T15:16:17.123", json["DateTime1"].GetValue<string>());
Assert.AreEqual("15:16:17.1230000", json["TimeOnly"].GetValue<string>());
#endif
}

[TestMethod]
Expand Down

0 comments on commit e3e7d53

Please sign in to comment.