DateOnlyTimeOnly.AspNet icon indicating copy to clipboard operation
DateOnlyTimeOnly.AspNet copied to clipboard

Enable passing format to converters

Open SefaOray opened this issue 3 years ago • 1 comments

Description

Library is using DateOnly.Parse method, which invokes default behavior from .Net itself. There are no additional signatures available to configure the behavior.

Example

When day is not passed as part of the string, value is set to 1 as default. This is from .Net, not library.

Proposal

Behavior can be avoided using DateOnly.ParseExact method with a format string but the library doesn't offer a signature to pass this value. More signatures needs to be added so user of this library can configure the behavior.

SefaOray avatar Jul 20 '22 07:07 SefaOray

Cool idea! But it might be out of the scope for this package. The goal here is to compensate for lacking support for DateOnly and TimeOnly in ASP.NET Core 6. You shouldn't need this package in .NET 7 (ASP.NET Core 7) (where proper support for those types has already added):

  • https://devblogs.microsoft.com/dotnet/announcing-dotnet-7-preview-6/#type-converters
  • https://devblogs.microsoft.com/dotnet/announcing-dotnet-7-preview-5/#source-generation-improvements

Adding features into this package that won't be present in .NET 7 will only complicate the migration process.

If you provide a way, how custom date formats binding can be achieved in .NET 7, I'll add it to this package.

maxkoshevoi avatar Aug 05 '22 10:08 maxkoshevoi

Closing as stale

maxkoshevoi avatar Oct 27 '22 22:10 maxkoshevoi