-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clearer date error messages #3956
base: main
Are you sure you want to change the base?
Conversation
The error 'Date must be a real date' does not help users to fix the problem, as it is not very descriptive. This breaks down the reasons why a date might not be a real date to help users fix the problem and continue with the service.
✅ You can preview this change here:Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
Added some limited additional guidance on other reasons why users might have left part of the date blank, or are encountering relative date error messages.
Added some decision help suggestions: alphagov/govuk-design-system-backlog#42 (comment) |
Hi @tomyems, thanks for this contribution. Edit: To be clear, this is specifically about the "If the date as a whole does not exist" section. Speaking personally, the error messaging is somewhat ambiguous because the error the user has made is itself often ambiguous and cannot be programatically determined. For example:
In both examples above, one or more fields could have been entered incorrectly, but it's not possible to determine with any certainty which field or fields are wrong. For this reason it is generally expected that teams validate the date as a whole (as though it came from a single input) rather than validating each of the fields individually. This doesn't apply if someone has left a field blank or entered the 42nd day of the 13th month, of course—in those cases it's obvious—but hopefully you see what I'm getting at. |
Yes that section is the hardest to get to work - and for transparency I do not have research to support this. For 31 06 2024, I believe 'Day must be a number between 1 and 30 for June' to be much more helpful that 'Date must be a real date'. This is because it provides the context to the user about what is wrong with the date - both that 'June' could be wrong or the '31' could be wrong (though it is biased towards 'day'). This is particularly helpful for users who are less familiar with the numerals for dates (perhaps used to different calendar systems and so on). This is why both the 'day' and 'month' field should be highlighted. You could try '31 June does not exist. For June, day must be a number between 1 and 30. For 31, month must be January, March, May, July, August, October, December.' - I've tried this several different ways/shorter - open to ideas about how to simplify it [similar, but slightly more complex argument for 29 02 2025] [P.S. can always drop the changes for this section and revert to 'Date must be a real date' - if not confident enough to support the changes, but happy with the others] |
The error 'Date must be a real date' does not help users to fix the problem, as it is not very descriptive. This breaks down the reasons why a date might not be a real date to help users fix the problem and continue with the service.