Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Commit c122bf5

Browse files
author
Konstantina Chremmou
committed
CA-333871: Corrected the serialization format for DateTime so the API accepts it.
Signed-off-by: Konstantina Chremmou <[email protected]>
1 parent 546c81f commit c122bf5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

csharp/autogen/src/Converters.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,19 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
415415

416416
return DateTime.MinValue;
417417
}
418+
419+
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
420+
{
421+
if (value is DateTime dateTime)
422+
{
423+
dateTime = dateTime.ToUniversalTime();
424+
var text = dateTime.ToString(DateFormatsUniversal[0], CultureInfo.InvariantCulture);
425+
writer.WriteValue(text);
426+
return;
427+
}
428+
429+
base.WriteJson(writer, value, serializer);
430+
}
418431
}
419432

420433

0 commit comments

Comments
 (0)