diff --git a/spec/feature/hearings/virtual_hearings/daily_docket_spec.rb b/spec/feature/hearings/virtual_hearings/daily_docket_spec.rb index ede34af5705..234e1041833 100644 --- a/spec/feature/hearings/virtual_hearings/daily_docket_spec.rb +++ b/spec/feature/hearings/virtual_hearings/daily_docket_spec.rb @@ -40,12 +40,15 @@ def check_email_events(hearing, current_user) context "Formerly Video Virtual Hearing" do let(:expected_central_office_time) do + time_str = "#{updated_hearing_time} #{hearing.hearing_day.scheduled_for} America/New_York" + tz_abbr = Time.zone.parse(time_str).dst? ? "ET" : "EST" + Time .parse(updated_hearing_time) .strftime("%F %T") .in_time_zone(regional_office_timezone) # cast the updated hearing time to the ro timezone .in_time_zone(HearingTimeService::CENTRAL_OFFICE_TIMEZONE) # convert it to the central office timezone - .strftime("%-l:%M %p ET") # and render it in the format expected in the modal + .strftime("%-l:%M %p #{tz_abbr}") # and render it in the format expected in the modal end scenario "Virtual hearing time is updated" do @@ -55,6 +58,7 @@ def check_email_events(hearing, current_user) click_dropdown(name: "optionalHearingTime0", text: updated_video_hearing_time) expect(page).to have_content(COPY::VIRTUAL_HEARING_MODAL_CHANGE_HEARING_TIME_TITLE) expect(page).to have_content(COPY::VIRTUAL_HEARING_MODAL_CHANGE_HEARING_TIME_BUTTON) + expect(page).to have_content("Time: #{expected_central_office_time} / #{expected_regional_office_time}") click_button(COPY::VIRTUAL_HEARING_MODAL_CHANGE_HEARING_TIME_BUTTON) diff --git a/spec/models/hearings/forms/hearing_update_form_spec.rb b/spec/models/hearings/forms/hearing_update_form_spec.rb index bd5cc15a416..ff8744beb7d 100644 --- a/spec/models/hearings/forms/hearing_update_form_spec.rb +++ b/spec/models/hearings/forms/hearing_update_form_spec.rb @@ -114,13 +114,18 @@ end it "should update scheduled_datetime if it is not null already" do + date_str = "#{hearing.hearing_day.scheduled_for} America/New_York" + is_dst = Time.zone.parse(date_str).dst? + hearing.update( - scheduled_datetime: "2021-04-23T11:30:00-04:00", scheduled_in_timezone: "America/New_York" + scheduled_datetime: "2021-04-23T11:30:00#{is_dst ? '-04:00' : '-05:00'}", + scheduled_in_timezone: "America/New_York" ) subject.update updated_scheduled_datetime = hearing.scheduled_datetime + expect(updated_scheduled_datetime.strftime("%Y-%m-%d %H:%M %z")) - .to eq "#{hearing.hearing_day.scheduled_for.strftime('%Y-%m-%d')} 21:45 -0400" + .to eq "#{hearing.hearing_day.scheduled_for.strftime('%Y-%m-%d')} 21:45 #{is_dst ? '-0400' : '-0500'}" end it "should not update scheduled_datetime if it is null already" do