Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Name used for date input parse errors should be overridable #282

Open
gunndabad opened this issue Oct 11, 2024 · 0 comments
Open

Name used for date input parse errors should be overridable #282

gunndabad opened this issue Oct 11, 2024 · 0 comments
Assignees

Comments

@gunndabad
Copy link
Owner

gunndabad commented Oct 11, 2024

When date input parsing encounters an error it produces an error using ModelMetadata's DisplayName https://github.com/gunndabad/govuk-frontend-aspnetcore/blob/main/src/GovUk.Frontend.AspNetCore/ModelBinding/DateInputModelConverterModelBinder.cs#L100

This is problematic when the display name is something like 'Enter start date' as we get error messages like 'Enter start date must be a real date'.

There should be a way to override the name used for producing parse errors e.g.

[DateInputMetadata(Name = "Start date")]
@gunndabad gunndabad self-assigned this Oct 11, 2024
@gunndabad gunndabad changed the title Field name used for date input parse errors should be overridable Name used for date input parse errors should be overridable Oct 14, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant