zijianhuang / webapiclientgen

Strongly Typed Client API Generators generate strongly typed client APIs in C# .NET and in TypeScript for jQuery and Angular 2+ from ASP.NET Web API and .NET Core Web API
MIT License
168 stars 38 forks source link

support date with DateOnly or DataTypeAttribute(DataType.Date) #114

Closed zijianhuang closed 2 years ago

zijianhuang commented 2 years ago

DateOnlyAttribute works for both .NET (Core) and .NET Framework, with JsonConverter.

DateOnly works for .NET.

https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations.datatypeattribute?view=net-6.0

https://docs.microsoft.com/en-us/dotnet/api/system.text.json.serialization.jsonconverter-1.canconvert?view=net-6.0#system-text-json-serialization-jsonconverter-1-canconvert(system-type)

https://www.newtonsoft.com/json/help/html/CustomJsonConverterGeneric.htm

https://kevsoft.net/2021/05/22/formatting-dateonly-types-as-iso-8601-in-asp-net-core-responses.html

zijianhuang commented 2 years ago

DateOnly to DateOnly

DataTypeAttribute is copied over for C# type.