diff --git a/app/presenters/idv/in_person/ready_to_verify_presenter.rb b/app/presenters/idv/in_person/ready_to_verify_presenter.rb index 7759de34057..988c2a00eac 100644 --- a/app/presenters/idv/in_person/ready_to_verify_presenter.rb +++ b/app/presenters/idv/in_person/ready_to_verify_presenter.rb @@ -24,8 +24,10 @@ def days_remaining end def formatted_due_date - enrollment.due_date.in_time_zone(USPS_SERVER_TIMEZONE). - strftime(I18n.t('time.formats.event_date')) + I18n.l( + enrollment.due_date.in_time_zone(USPS_SERVER_TIMEZONE), + format: :event_date, + ) end def selected_location_hours(prefix) diff --git a/app/presenters/idv/in_person/verification_results_email_presenter.rb b/app/presenters/idv/in_person/verification_results_email_presenter.rb index 55a79260aa4..724245d6ee9 100644 --- a/app/presenters/idv/in_person/verification_results_email_presenter.rb +++ b/app/presenters/idv/in_person/verification_results_email_presenter.rb @@ -17,8 +17,9 @@ def initialize(enrollment:, url_options:, visited_location_name:) end def formatted_verified_date - enrollment.status_updated_at.in_time_zone(USPS_SERVER_TIMEZONE).strftime( - I18n.t('time.formats.event_date'), + I18n.l( + enrollment.status_updated_at.in_time_zone(USPS_SERVER_TIMEZONE), + format: :event_date, ) end diff --git a/config/locales/es.yml b/config/locales/es.yml index 6088031fd6b..ac4c70204ad 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1207,7 +1207,7 @@ image_description.warning: Señal amarilla de precaución in_person_proofing.body.barcode.cancel_link_text: Cancele su código de barras in_person_proofing.body.barcode.close_window: Ya puede cerrar esta ventana. in_person_proofing.body.barcode.deadline: Debe acudir a cualquier oficina de correos participante antes del %{deadline} -in_person_proofing.body.barcode.deadline_restart: Si vence el plazo, su información no se guardará y tendrá que reiniciar el proceso. +in_person_proofing.body.barcode.deadline_restart: Si acude después del plazo, su información no se guardará y tendrá que reiniciar el proceso. in_person_proofing.body.barcode.eipp_tag: Código de barras piloto mejorado GSA in_person_proofing.body.barcode.eipp_what_to_bring: 'Según el tipo de identificación que tenga, es posible que deba presentar documentos comprobatorios. Lea con atención las opciones siguientes:' in_person_proofing.body.barcode.email_sent: Enviamos el código de barras y la información más abajo al correo electrónico que usó para iniciar sesión @@ -1570,7 +1570,7 @@ step_indicator.status.complete: Completado step_indicator.status.current: Este paso step_indicator.status.not_complete: No completado time.am: a. m. -time.formats.event_date: '%B %-d, %Y' +time.formats.event_date: '%-d de %B de %Y' time.formats.event_time: '%-l:%M %p' time.formats.event_timestamp: '%B %-d, %Y a las %-l:%M %p' time.formats.event_timestamp_js: '%{month} %{day}, %{year} a las %{hour}:%{minute} %{day_period}' diff --git a/config/locales/zh.yml b/config/locales/zh.yml index bf67215f67a..67d19ae168f 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1571,7 +1571,7 @@ step_indicator.status.complete: 完成了 step_indicator.status.current: 目前步骤 step_indicator.status.not_complete: 未完成 time.am: 上午 -time.formats.event_date: '%B %-d, %Y' +time.formats.event_date: '%Y年%B%-d日' time.formats.event_time: '%-l:%M %p' time.formats.event_timestamp: '%B %-d, %Y at %-l:%M %p' time.formats.event_timestamp_js: '%{year}年%{month}月%{day}日, %{hour}:%{minute} %{day_period}' diff --git a/spec/i18n_spec.rb b/spec/i18n_spec.rb index 370714691d6..220d6842536 100644 --- a/spec/i18n_spec.rb +++ b/spec/i18n_spec.rb @@ -70,7 +70,6 @@ class BaseTask { key: 'simple_form.no', locales: %i[es] }, # "No" is "No" in Spanish { key: 'telephony.format_length.six', locales: %i[zh] }, # numeral is not translated { key: 'telephony.format_length.ten', locales: %i[zh] }, # numeral is not translated - { key: 'time.formats.event_date', locales: %i[es zh] }, { key: 'time.formats.event_time', locales: %i[es zh] }, { key: 'time.formats.event_timestamp', locales: %i[zh] }, { key: 'time.formats.full_date', locales: %i[es] }, # format is the same in Spanish and English diff --git a/spec/presenters/idv/in_person/ready_to_verify_presenter_spec.rb b/spec/presenters/idv/in_person/ready_to_verify_presenter_spec.rb index 21bb5c2e455..aae5df981fb 100644 --- a/spec/presenters/idv/in_person/ready_to_verify_presenter_spec.rb +++ b/spec/presenters/idv/in_person/ready_to_verify_presenter_spec.rb @@ -23,21 +23,33 @@ ) end subject(:presenter) { described_class.new(enrollment: enrollment) } - describe '#formatted_due_date' do - subject(:formatted_due_date) { presenter.formatted_due_date } - - around do |example| - Time.use_zone('UTC') { example.run } - end - it 'returns a formatted due date' do - expect(formatted_due_date).to eq 'August 12, 2023' + describe '#formatted_due_date' do + let(:enrollment_established_at) { DateTime.new(2024, 7, 5) } + + context 'when the enrollment has an enrollment_established_at time' do + [ + ['English', :en, 'August 3, 2024'], + ['Spanish', :es, '3 de agosto de 2024'], + ['French', :fr, '3 août 2024'], + ['Chinese', :zh, '2024年8月3日'], + ].each do |language, locale, expected| + context "when locale is #{language}" do + before do + I18n.locale = locale + end + + it "returns the formatted due date in #{language}" do + expect(presenter.formatted_due_date).to eq(expected) + end + end + end end - context 'there is no enrollment_established_at' do + context 'when the enrollment does not have an enrollment_established_at time' do let(:enrollment_established_at) { nil } it 'returns formatted due date when no enrollment_established_at' do - expect(formatted_due_date).to eq 'July 13, 2023' + expect(presenter.formatted_due_date).to eq 'July 13, 2023' end end end diff --git a/spec/presenters/idv/in_person/verification_results_email_presenter_spec.rb b/spec/presenters/idv/in_person/verification_results_email_presenter_spec.rb index e320151a0a7..563a1f3d620 100644 --- a/spec/presenters/idv/in_person/verification_results_email_presenter_spec.rb +++ b/spec/presenters/idv/in_person/verification_results_email_presenter_spec.rb @@ -31,13 +31,25 @@ end describe '#formatted_verified_date' do - around do |example| - Time.use_zone('UTC') { example.run } + before do + enrollment.update(status_updated_at: DateTime.new(2024, 7, 5)) end - it 'returns a formatted verified date' do - enrollment.update(status_updated_at: status_updated_at) - expect(presenter.formatted_verified_date).to eq 'July 13, 2022' + [ + ['English', :en, 'July 4, 2024'], + ['Spanish', :es, '4 de julio de 2024'], + ['French', :fr, '4 juillet 2024'], + ['Chinese', :zh, '2024年7月4日'], + ].each do |language, locale, expected| + context "when locale is #{language}" do + before do + I18n.locale = locale + end + + it "returns the formatted due date in #{language}" do + expect(presenter.formatted_verified_date).to eq(expected) + end + end end end