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
167 stars 38 forks source link

outstanding issues of DateOnly in ASP.NET 7? #125

Closed zijianhuang closed 1 year ago

zijianhuang commented 1 year ago

mostly working, however, in some scenarios, the Web API binding does not seem to handle well the Date data from JavaScript clients.

Before reporting to MS .NET team, find out:

  1. If there's some special serialization settings, with the

In the report, create a MVC project with normal date picker, and Angular Material DatePicker.

Verify the fix in the DotNet7 branch.

References: https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.dateonlyconverter?view=net-7.0 https://devblogs.microsoft.com/dotnet/announcing-dotnet-7 https://devblogs.microsoft.com/dotnet/system-text-json-in-dotnet-7/

zijianhuang commented 1 year ago

for the time being, keeping my DateOnlyJsonConverter is better.

zijianhuang commented 1 year ago

In .NET 6, without DateOnlyJsonConverter in branch net6WithoutConverter

PS C:\VSProjects\OpenSource\DemoCoreWeb> C:\VSProjects\OpenSource\DemoCoreWeb\StartCoreWebApi.ps1
2022-11-12T07:42:05.53996+10:00

year      : 2022
month     : 11
day       : 12
dayOfWeek : 6
dayOfYear : 316
dayNumber : 738470

With DateOnlyJsonConverter in branch Net6

PS C:\VSProjects\OpenSource\DemoCoreWeb> C:\VSProjects\OpenSource\DemoCoreWeb\StartCoreWebApi.ps1
2022-11-12T07:39:27.0768061+10:00
2022-11-12
zijianhuang commented 1 year ago

https://www.codeproject.com/Tips/5347015/DateOnly-in-ASP-NET-7-with-JavaScript-Clients