处理日期

This commit is contained in:
qianhao.xu
2025-02-19 10:00:48 +08:00
parent 90e940b2a1
commit f6d4987056
2 changed files with 69 additions and 2 deletions

View File

@@ -13,6 +13,7 @@ using DOAN.Infrastructure.WebExtensions;
using DOAN.ServiceCore.Signalr;
using DOAN.ServiceCore.SqlSugar;
using Microsoft.Extensions.FileProviders;
using static Infrastructure.Converter.JsonConverterUtil;
var builder = WebApplication.CreateBuilder(args);
// NLog: Setup NLog for Dependency injection
@@ -71,7 +72,8 @@ builder.Services.AddMvc(options =>
options.JsonSerializerOptions.WriteIndented = true;
options.JsonSerializerOptions.Converters.Add(new JsonConverterUtil.DateTimeConverter());
options.JsonSerializerOptions.Converters.Add(new JsonConverterUtil.DateTimeNullConverter());
options.JsonSerializerOptions.Converters.Add(new JsonConverterUtil.DateTimeArrayConverter());
options.JsonSerializerOptions.Converters.Add(new JsonConverterUtil.DateTimeArrayConverter());
options.JsonSerializerOptions.Converters.Add(new JsonConverterUtil.DateTimeNullableArrayConverter());
options.JsonSerializerOptions.Converters.Add(new StringConverter());
//PropertyNamingPolicy属性用于前端传过来的属性的格式策略目前内置的仅有一种策略CamelCase
options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;