From ce2e45eb54d9602428ea5b87f540534bad6311bd Mon Sep 17 00:00:00 2001 From: Arthur Campbell Date: Mon, 13 Feb 2023 11:28:02 +0000 Subject: [PATCH] change hardcoded date text to today's date formatted correctly --- app/views/form/_date_question.html.erb | 2 +- config/initializers/date_formats.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/form/_date_question.html.erb b/app/views/form/_date_question.html.erb index 153679ace..dc951e162 100644 --- a/app/views/form/_date_question.html.erb +++ b/app/views/form/_date_question.html.erb @@ -3,7 +3,7 @@ <%= f.govuk_date_field question.id.to_sym, caption: caption(caption_text, page_header, conditional), legend: legend(question, page_header, conditional), - hint: { text: question.hint_text&.html_safe || "For example, 1 9 2022." }, + hint: { text: question.hint_text&.html_safe || "For example, #{Time.zone.today.to_formatted_s(:govuk_date_number_month)}" }, width: 20, **stimulus_html_attributes(question) do %> <%= govuk_inset_text(text: question.unresolved_hint_text) if question.unresolved_hint_text.present? && @log.unresolved %> diff --git a/config/initializers/date_formats.rb b/config/initializers/date_formats.rb index 59bc215ce..71179f6d2 100644 --- a/config/initializers/date_formats.rb +++ b/config/initializers/date_formats.rb @@ -2,6 +2,7 @@ Time::DATE_FORMATS[:govuk_date] = "%-d %B %Y" Time::DATE_FORMATS[:govuk_date_short_month] = "%-d %b %Y" Date::DATE_FORMATS[:govuk_date] = "%-d %B %Y" Date::DATE_FORMATS[:govuk_date_short_month] = "%-d %b %Y" +Date::DATE_FORMATS[:govuk_date_number_month] = "%-d %-m %Y" Time::DATE_FORMATS[:month_and_year] = "%B %Y" Date::DATE_FORMATS[:month_and_year] = "%B %Y"