diff --git a/src/OutputFormatters/JsonOutputFormatter.cs b/src/OutputFormatters/JsonOutputFormatter.cs index 5f0c977..72d721b 100644 --- a/src/OutputFormatters/JsonOutputFormatter.cs +++ b/src/OutputFormatters/JsonOutputFormatter.cs @@ -1,4 +1,5 @@ using System.Text.Json; +using System.Text.Json.Serialization; using AzureCostCli.CostApi; using DevLab.JmesPath; using Spectre.Console; @@ -70,7 +71,14 @@ public override Task WriteDailyCost(DailyCostSettings settings, IEnumerable +{ + public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return DateOnly.FromDateTime(reader.GetDateTime()); + } + + public override void Write(Utf8JsonWriter writer, DateOnly value, JsonSerializerOptions options) + { + var isoDate = value.ToString("O"); + writer.WriteStringValue(isoDate); + } } \ No newline at end of file