Skip to content

Commit

Permalink
Modify scheduled publication date validation error message
Browse files Browse the repository at this point in the history
The updated message is closer to the guidance provided at https://design-system.service.gov.uk/components/date-input/, but the guidance doesn't cover cases where the user enters, for example, a string instead of a number for one of the date parts. It also assumes that invidividual parts of the date can be validated separately. For this reason I have had to improvise a little, but I believe the new message is closer to the spirit of the guidance and does not feature the unapproved XX style formatting advice.
  • Loading branch information
ryanb-gds committed Sep 8, 2023
1 parent 52d95c0 commit 41cf9d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/edition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ def scheduled_publication=(date)

def valid_date
if @date_field_validity.present? && @date_field_validity[:scheduled_publication] == false
errors.add(:scheduled_publication, "must be a valid date in the format XX XX XXXX")
errors.add(:scheduled_publication, "must be a valid date in the correct format")
end
end

Expand Down

0 comments on commit 41cf9d5

Please sign in to comment.