Skip to content

Commit

Permalink
ensure proper format_time translation
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwoldatwork committed Jan 6, 2025
1 parent 76153a8 commit 34b2426
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ def organization_abbreviation_dropdown_options
end

def us_timezones
us_timezones = ActiveSupport::TimeZone["Eastern Time (US & Canada)"],
[
ActiveSupport::TimeZone["Eastern Time (US & Canada)"],
ActiveSupport::TimeZone["Central Time (US & Canada)"],
ActiveSupport::TimeZone["Mountain Time (US & Canada)"],
ActiveSupport::TimeZone["Pacific Time (US & Canada)"],
ActiveSupport::TimeZone["Hawaii"]
]
end

def hisp_questions_key
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ en-US:
- Fri
- Sat
abbr_month_names:
-
- Jan
- Feb
- Mar
Expand All @@ -34,6 +35,7 @@ en-US:
long: "%B %d, %Y"
short: "%b %d"
month_names:
-
- January
- February
- March
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ en-US:
pm: pm
date:
abbr_month_names:
-
- Jan
- Feb
- Mar
Expand All @@ -69,6 +70,7 @@ en-US:
- Nov
- Dec
month_names:
-
- January
- February
- March
Expand Down
2 changes: 2 additions & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ es:
- vie
- sáb
abbr_month_names:
-
- ene
- feb
- mar
Expand All @@ -93,6 +94,7 @@ es:
with_timezone: "%-d de %B de %Y (UTC%:z)"
short: "%-d de %b"
month_names:
-
- enero
- febrero
- marzo
Expand Down
2 changes: 2 additions & 0 deletions config/locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ zh-CN:
- 周五
- 周六
abbr_month_names:
-
- 1月
- 2月
- 3月
Expand All @@ -113,6 +114,7 @@ zh-CN:
with_timezone: "%Y年%m月%d日 (%:z)"
short: "%m月%d日"
month_names:
-
- 一月
- 二月
- 三月
Expand Down
10 changes: 8 additions & 2 deletions spec/features/admin/forms_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@

describe 'editing form timezone' do
let!(:form_with_responses) { FactoryBot.create(:form, :single_question, :with_responses, organization:) }
let!(:additional_response) { FactoryBot.create(:submission, form: form_with_responses, answer_01: "hi", created_at: "2025-01-02") }
let!(:user_role) { FactoryBot.create(:user_role, :form_manager, user: admin, form: form_with_responses) }

before do
Expand All @@ -764,9 +765,14 @@
expect(page).to have_content('Form Manager forms options updated successfully')
end

it 'can view submissions with a form time_zone' do
it 'renders valid time' do
visit responses_admin_form_path(form_with_responses)
expect(page.all("#submissions_table .usa-table.submissions tbody tr").size).to eq(3)
expect(page.all("#submissions_table .usa-table.submissions tbody tr").size).to eq(4)
end

it 'ensure format_time translation is correct' do
visit responses_admin_form_path(form_with_responses)
expect(all("#submissions_table .usa-table.submissions tbody tr").last).to have_content("January 01, 2025")
end
end

Expand Down

0 comments on commit 34b2426

Please sign in to comment.