Adds support for receiving and returning DateOnly/TimeOnly as ISO 8601 string to ASP.NET Core API
Get it from NuGet
Call AddDateOnlyTimeOnlyStringConverters on services:
builder.Services.AddDateOnlyTimeOnlyStringConverters();After that:
- For .NET 6: all
DateOnlyandTimeOnlyaction arguments will be received and returned as ISO 8601 string; - For .NET 7: adds support to use
TimeOnlyas Dictionary key (the rest is available out of the box).
No additional action is needed.
No additional action is needed.
Install DateOnlyTimeOnly.AspNet.Swashbuckle package, and add UseDateOnlyTimeOnlyStringConverters to your swagger configuration:
builder.Services.AddSwaggerGen(c => c.UseDateOnlyTimeOnlyStringConverters());