RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.67k stars 1.23k forks source link

Suggestion: Implement support for @js-joda/core date/time handling for full compatibility with NodaTime #4712

Open anthonn opened 7 months ago

anthonn commented 7 months ago

In C# a well used nuget is NodaTime. It aims to solve many disadvantages with the built in DateTime. https://www.nuget.org/packages/NodaTime

The entity framework data driver Npgsql for PostgreSql also suggests to use NodaTime https://www.npgsql.org/efcore/mapping/nodatime.html

In Nswag NodaTime maps ok to at least luxon, if an Instant is used (UTC time). But if using something like NodaTime LocalDate (which has no time component), I do not see how this could be mapped in a nice way to either luxon or day.js.

@js-joda/core is not as popular as luxon or day.js, but seems like the best match fontend for NodaTime, and has many advantages compared to thoose libraries. https://www.npmjs.com/package/@js-joda/core

I've managed to configure Nswag to create and parse NodaTime Instant towards Instant in @js-joda/core, but it would be really nice if this was supported "out of the box".