-
Notifications
You must be signed in to change notification settings - Fork 3
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
ROE-2313 Trim leading zeros from date fields #995
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Added extra tests that check the leading zeros are removed by capturing the req.body when it is passed into a mock and checking the date fields in that compared to what we originally sent in the post request. |
SonarQube Quality Gate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Could we use the 'maxlength' attribute in the input field to prevent the issue happening in the first place? |
that could be a better solution, I can try that out |
Looking into using maxlength, the govuk nunjucks date component doesn't seem to support it and further digging led me to this question on the alphagov github site, where they don't recommend maxlength, but instead suggest displaying an error to the user. This PR doesn't match this approach (it auto trims the leading zeros) so perhaps solution might need to be re-done to display message to user instead - alphagov/govuk-design-system#1977 |
Displaying an error sounds good, particularly if it's the recommend approach. It gives immediate feedback to the user and prevents us having to manipulate data that's been entered. |
JIRA link
https://companieshouse.atlassian.net/browse/ROE-2313
Change description
Trimming any leading zeros from date values to prevent errors when saving to the Api
Work checklist
Merge instructions
We are committed to keeping commit history clean, consistent and linear. To achieve this, this commit should be structured as follows:
and contain the following structural elements:
BREAKING CHANGE:
introduces a breaking API change (correlating with MAJOR in semantic versioning). A BREAKING CHANGE can be part of commits of any type,fix:
andfeat:
are allowed, for examplebuild:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
, and others,BREAKING CHANGE: <description>
may be provided.