Original issue is here with more context: Azure/azure-cosmos-dotnet-v3#1468
System.Text.Json docs here: https://docs.microsoft.com/en-us/dotnet/standard/datetime/system-text-json-support#the-extended-iso-8601-12019-profile-in-systemtextjson
Basically, System.Text.Json will truncate a serialized DateTime to avoid writing extra zeroes.
2020-05-02T18:42:34.9787000Z
would become:
2020-05-02T18:42:34.9787Z
The specific problem is with Cosmos. I want to be able to write queries with order by SomeDate. But I can't with default serialization, because unless the same number of decimals are outputted, it's not sortable.
We've already worked around the problem by introducing a custom Cosmos serializer.
But I'll submit it for consideration here, too. If it's a no-go, no problem :)
One potential suggestion would be a serializer option such as bool SkipDateTimeCompression or bool AlwaysOutput7FractionalSecondsDigitsPlease.
Original issue is here with more context: Azure/azure-cosmos-dotnet-v3#1468
System.Text.Json docs here: https://docs.microsoft.com/en-us/dotnet/standard/datetime/system-text-json-support#the-extended-iso-8601-12019-profile-in-systemtextjson
Basically, System.Text.Json will truncate a serialized DateTime to avoid writing extra zeroes.
2020-05-02T18:42:34.9787000Zwould become:
2020-05-02T18:42:34.9787ZThe specific problem is with Cosmos. I want to be able to write queries with
order by SomeDate. But I can't with default serialization, because unless the same number of decimals are outputted, it's not sortable.We've already worked around the problem by introducing a custom Cosmos serializer.
But I'll submit it for consideration here, too. If it's a no-go, no problem :)
One potential suggestion would be a serializer option such as
bool SkipDateTimeCompressionorbool AlwaysOutput7FractionalSecondsDigitsPlease.