79652069

Date: 2025-06-04 02:33:18
Score: 0.5
Natty:
Report link

What you want is not really the same as the datetime standards as the comments above. However your code works. So I see you have defined a ModelBinder for the DateOnly type. If you want to format input with output you should change this step from:

 if (DateOnly.TryParse(value, out var date))
        {
            bindingContext.Result = ModelBindingResult.Success(date);
        }

to

 var value = valueProviderResult.FirstValue;
 string format = "dd.MM.yyyy";
 CultureInfo culture = CultureInfo.InvariantCulture;
 
 if (DateOnly.TryParseExact(value, format, culture, DateTimeStyles.None, out var date))
 {
     bindingContext.Result = ModelBindingResult.Success(date);
 }
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): What you
  • Low reputation (1):
Posted by: công