diff --git a/client/app/hearings/utils.js b/client/app/hearings/utils.js index ef69f920b3d..b4a38677e5a 100644 --- a/client/app/hearings/utils.js +++ b/client/app/hearings/utils.js @@ -663,8 +663,12 @@ const calculateAvailableTimeslots = ({ }) => { // Extract the hearing time, add the hearing_day date from beginsAt, set the timezone be the ro timezone const hearingTimes = scheduledHearings.map((hearing) => { - const [hearingHour, hearingMinute] = hearing.hearingTime.split(':'); - const hearingTimeMoment = beginsAt.clone().set({ hour: hearingHour, minute: hearingMinute }); + const hearingClockTime = splitSelectedTime(hearing.hearingTime)[0]; + const parsedClockTime = moment(hearingClockTime, 'h:mm A'); + + const hearingTimeMoment = beginsAt.clone().set({ + hour: parsedClockTime.get('Hour'), minute: parsedClockTime.get('Minute') + }); // Change which zone the time is in but don't convert, "08:15 EDT" -> "08:15 PDT" return hearingTimeMoment.tz(roTimezone, true); @@ -725,11 +729,11 @@ const combineSlotsAndHearings = ({ roTimezone, availableSlots, scheduledHearings key: `${slot?.slotId}-${slot?.time_string}`, full: false, // This is a moment object, always in "America/New_York" - hearingTime: slot.time.format('HH:mm') + hearingTime: slot.time.format('HH:mm A') })); const formattedHearings = scheduledHearings.map((hearing) => { - const time = moment.tz(`${hearing?.hearingTime} ${hearingDayDate}`, 'HH:mm YYYY-MM-DD', roTimezone).clone(). + const time = moment.tz(`${hearing?.hearingTime} ${hearingDayDate}`, 'HH:mm A YYYY-MM-DD', roTimezone).clone(). tz('America/New_York'); return { @@ -740,7 +744,7 @@ const combineSlotsAndHearings = ({ roTimezone, availableSlots, scheduledHearings time, // The hearingTime is in roTimezone, but it looks like "09:30", this takes that "09:30" // in roTimezone, and converts it to Eastern zone because slots are always in eastern. - hearingTime: time.format('HH:mm') + hearingTime: time.format('HH:mm A') }; }); diff --git a/client/test/app/hearings/components/scheduleHearing/TimeSlotButton.test.js b/client/test/app/hearings/components/scheduleHearing/TimeSlotButton.test.js index 6d8022fb9b0..9b7b75902d3 100644 --- a/client/test/app/hearings/components/scheduleHearing/TimeSlotButton.test.js +++ b/client/test/app/hearings/components/scheduleHearing/TimeSlotButton.test.js @@ -4,7 +4,7 @@ import { TimeSlotButton } from 'app/hearings/components/scheduleHearing/TimeSlot import { render } from '@testing-library/react'; import { roTimezones, formatTimeSlotLabel } from 'app/hearings/utils'; -const time = '08:15'; +const time = '15:15 PM'; const hearingDayDate = '2025-01-01'; const issueCount = 2; const poaName = 'Something'; diff --git a/client/test/app/hearings/components/scheduleHearing/__snapshots__/TimeSlotButton.test.js.snap b/client/test/app/hearings/components/scheduleHearing/__snapshots__/TimeSlotButton.test.js.snap index 9c8f1cd3ac4..fcc008289f6 100644 --- a/client/test/app/hearings/components/scheduleHearing/__snapshots__/TimeSlotButton.test.js.snap +++ b/client/test/app/hearings/components/scheduleHearing/__snapshots__/TimeSlotButton.test.js.snap @@ -14,7 +14,7 @@ Object {
- 8:15 AM EST + 3:15 PM EST
@@ -32,7 +32,7 @@ Object {
- 8:15 AM EST + 3:15 PM EST
@@ -108,7 +108,7 @@ Object {
- 8:15 AM EST + 3:15 PM EST
- 8:15 AM EST + 3:15 PM EST
- 8:15 AM EST + 3:15 PM EST
- 8:15 AM EST + 3:15 PM EST