From 162967e68b75bb741b12206014dd9867a7e897ff Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 29 Jul 2025 22:38:13 +0800 Subject: [PATCH] :bug: Fix grpc type helper make mistakes on nodatime --- DysonNetwork.Shared/Proto/GrpcTypeHelper.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DysonNetwork.Shared/Proto/GrpcTypeHelper.cs b/DysonNetwork.Shared/Proto/GrpcTypeHelper.cs index 9733525..3210342 100644 --- a/DysonNetwork.Shared/Proto/GrpcTypeHelper.cs +++ b/DysonNetwork.Shared/Proto/GrpcTypeHelper.cs @@ -6,13 +6,15 @@ using Google.Protobuf.Collections; using Google.Protobuf.WellKnownTypes; using DysonNetwork.Shared.Data; using Google.Protobuf; +using NodaTime; +using NodaTime.Serialization.SystemTextJson; using JsonSerializer = System.Text.Json.JsonSerializer; namespace DysonNetwork.Shared.Proto; public abstract class GrpcTypeHelper { - public static readonly JsonSerializerOptions? SerializerOptions = new() + private static readonly JsonSerializerOptions? SerializerOptions = new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower, DefaultIgnoreCondition = JsonIgnoreCondition.Never, @@ -21,7 +23,7 @@ public abstract class GrpcTypeHelper { Modifiers = { JsonExtensions.UnignoreAllProperties() } } - }; + }.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb); public static MapField ConvertToValueMap(Dictionary source) {