Skip to content

Add date/time selection step for appointment booking. - #1098

Merged
veenupunyani merged 2 commits into
developfrom
choose-date-and-time-for-appointment
Jul 30, 2026
Merged

Add date/time selection step for appointment booking.#1098
veenupunyani merged 2 commits into
developfrom
choose-date-and-time-for-appointment

Conversation

@veenupunyani

Copy link
Copy Markdown
Collaborator

PR Summary

  1. Added booking step 4 at /datetime so signed-in users could pick an available date and time for their selected service and location.
  2. Added a small timeslots API client that loaded office slots, mapped dates to YYYY-MM-DD, and kept only bookable times.
  3. Persisted the chosen slot in booking context / session storage, cleared it when service or location changed, and enabled Login Continue to reach this step. Review/Continue to step 5 was left out for now.

Testing Steps

  1. Continue from login reaches /datetime and shows available dates/times.
  2. Selecting a day and time updates the callout; unavailable dates/times are not selectable.
  3. Refresh keeps the slot; changing service/location clears it.
  4. Missing auth or service/location shows the existing go-back guards.
  5. Check desktop and mobile layout.

Added booking step 4 date and time selection.

Protected /datetime page loads office slots, lets users pick a day and time with the BCDS calendar and radios, and saves the choice in booking context.

@chrsamp chrsamp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @veenupunyani, nice implementation here. A few comments below but looking good.

Maybe in a few sprints we can fix the ugly MM/DD/YYYY date format that the API is returning and switch to ISO dates, but that would probably break the Q frontend... I'm not sure why we did that!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing some package vulnerabilities when I run npm install, can you please run npm audit and update to latest versions to fix, thanks.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i will do that in upcoming refactor ticket https://citz-sbc.atlassian.net/browse/DEV-81

Comment on lines +274 to +276
<p className="datetime-selected-day" aria-live="polite">
{formatDate(activeDay)}
</p>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please move this to be displayed above the time options?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +254 to +272
<RadioGroup
aria-label={`Available times for ${formatDate(activeDay)}`}
value={selectedSlotValue}
onChange={(value) => {
const slot = activeDaySlots.find(
({ startTime, endTime }) => slotValue(startTime, endTime) === value,
)
if (slot) setSelectedSlot({ date: activeDay, ...slot })
}}
>
{activeDaySlots.map((slot) => {
const value = slotValue(slot.startTime, slot.endTime)
return (
<Radio key={value} value={value}>
{formatTimeRange(slot.startTime, slot.endTime)}
</Radio>
)
})}
</RadioGroup>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I cannot tab to focus the radio group. The calendar works with keyboard navigation (great!) and once the radio group is focused, I can use the keyboard to change options, but I cannot focus it: focus skips to the Back button after the radio group.

The guidance from the design and accessibility teams on the radio group component is to use it only when there are fewer than 7 options. Might be a good idea (maybe simpler too?) to modify this to use a select/dropdown instead. i.e. https://services.ontario.ca/appointment-booking/step4. The dropdown lists the start times of the appointments. If you wanted to get really fancy you could figure out the duration of the appointment from the Timeslot!

Image

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, yeah swiched to dropdown

Comment on lines +11 to +17
function persistJson(key: string, value: unknown) {
if (value) {
addJsonToSession(key, value)
} else {
removeFromSession(key)
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice simple extraction :-)

@sonarqubecloud

Copy link
Copy Markdown

@veenupunyani
veenupunyani merged commit 6021b4f into develop Jul 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants