DEV - Update Datepicker: Start Date, End Date, Remove Chips
Dependency
- [x] #1891
- [x] #1892
Overview
We need to update the DatePicker component to utilize two different fields for Start Date and End Date, as well as remove the pre-defined date chips. This will reduce user confusion around how to complete their date range selection.
Action Items
Before getting started...
- [x] ⚠️ I acknowledge that we are not implementing the pre-selected date chips in the spec ⚠️
- see Resource,
Screenshot: Date Chips In Spec, Do Not Implement
- see Resource,
Updating the date picker form fields and dropdowns...
- [x] Modify the DateSelector component to replace the pre-selected date chips with the ReactDayPicker modal
- [x] Remove the
<DateRanges>component withinSelectorBox.Collapse, replace with<ReactDayPicker> - [x] Remove the separator div
- [x] Remove the
- [x] Modify the DatePicker component to have two new fields, StartDate and EndDate
- [x] Update the Calendar icon to use the new SVG (see references)
- [x] Move the Calendar icon to the same form field as StartDate
- [x] Modify
renderSelectedDays()to populate these two fields, rather than populating the spans- [x] Extra Credit: write in a comment how you might write tests for this user flow
- [x] Modify border styles on focus
- [x] border size is 2px
- [x] border color is SecondaryFocus
- [x] Modify text color styles...
- [x] White (
#FFFFFF) when a date is provided (pls confirm w/ design) - [x] TextSecondaryLight when a date is not provided
- [x] White (
- [x] Modify ReactDayPicker...
- [x] previous and next arrows should be PrimaryFocus from
theme/colors.js - [x] Selected Start Day styles are modified...
- [x] background color will be SecondaryFocus
- [x] text color will be TextPrimaryDark
- [x] border is removed
- [x] Selected range (without start and end dates) styles are modified...
- [x] background color will be PrimaryLight
- [x] Selected End Day styles are modified...
- [x] background color will be PrimaryLight
- [x] border color is SecondaryFocus
- [x] border size should be
1px - [x] text color should be TextSecondaryLight
- [x] Extra Credit: find a way to standardize styles within this file, try to reduce usage of magic numbers, but without adding unnecessary indirection
- [x] previous and next arrows should be PrimaryFocus from
- [x] Ensure functionality matches the specification, document how you would test the interaction
- [x] ReactDayPicker should highlight the StartDate/EndDate form field when selecting a new start date/end date (respectively)
- [x] Clicking the StartDate/EndDate should open the ReactDayPicker dropdown
- [x] The ReactDayPicker dropdown should close once both StartDate and EndDate have been selected
- [ ] Optional: Consider refactoring components to use more sensible names and/or organization
- [ ] Suggestion: combine DateSelector with DatePicker component, named DateSelectionForm
- [ ] Suggestion: rename ReactDayPicker to DayPickerContainer
- [ ] Extra Credit: make a ticket(s) to do the following...
- [ ] ensure colors are being chosen from our theme file, everywhere in the app
- [ ] consider adopting Tailwind CSS, or some other way of moving our theme data out of bundled JS files
Resources/Instructions
Calendar Icon SVG
<svg width="16" height="17" viewBox="0 0 16 17" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.6667 3.16671H12V1.83337H10.6667V3.16671H5.33333V1.83337H4V3.16671H3.33333C2.59333 3.16671 2 3.76671 2 4.50004V13.8334C2 14.5667 2.59333 15.1667 3.33333 15.1667H12.6667C13.4 15.1667 14 14.5667 14 13.8334V4.50004C14 3.76671 13.4 3.16671 12.6667 3.16671ZM12.6667 13.8334H3.33333V6.50004H12.6667V13.8334ZM4.33333 9.16671C4.33333 8.24671 5.08 7.50004 6 7.50004C6.92 7.50004 7.66667 8.24671 7.66667 9.16671C7.66667 10.0867 6.92 10.8334 6 10.8334C5.08 10.8334 4.33333 10.0867 4.33333 9.16671Z" fill="#A8A8A8"/>
</svg>
Screenshot: Date Chips In Spec, Do Not Implement
⚠️ We are not adding the chips shown below. Please disregard area marked by the red box ⚠️
Screenshot: Figma Section at a Glance
Date picker components with no parent components
Date picker components within the Search and Filters modal
Hand Off Materials
- Figma Section Name: Search/Filter Modal #1600 - Final
- Interactive Prototype Figma file
- please refer to the 'Allison J' page and the wireframes under 'INTERACTIVE PROTOTYPE - 2.27.24'
- Popover Message Figma file - refer to the 'Anna K' page and the 'Popover' section
- Interactive Prototype Figma file
- Design issue for reference: https://github.com/hackforla/311-data/issues/1600
Screenshot before proposed changes
Screenshot after proposed changes
Moving out of icebox now that last dependency is met:
- https://github.com/hackforla/311-data/issues/1891
We are holding off on this because these designs still have the pre-selected date chips, which I know for a fact we are removing as part of the blank map designs:
- https://github.com/hackforla/311-data/issues/1944
Almost done working on this ticket. I'm realizing that we do want the dropdown functionality, but now the dropdown will trigger as part of opening the day picker. The day picker will no longer popover as a dialog, but should take up dedicated space in the search and filters modal.
ETA tmo.
This is ready to be picked up 👍
- Progress: n/a
- Blockers: n/a
- Availability: Sat - Sun 6pm - 9pm
- ETA: 2025-09-05
Unassigning since Melissa is working on
- https://github.com/hackforla/311-data/issues/2013
Per meeting on 9/24/2025, will merge into main once complete.
ETA: 8 October 2025 Availability: weekday afternoons - evenings
Update
- So far, I have managed to get a good start on this ticket. No questions as of yet, but I have checked off the boxes for what I have done.
- Blockers: job interview prep, study prep.
- Availability: weekdays after 5pm pacific time.
- New ETA for issue completion: 22 October 2025 (since I have to study now as well)
Blockers: need help figuring out where the dang dropdown arrow comes from :)
Update: figured out where the dropdown arrow comes from and got it hidden. Blocker: with the arrow hidden, now the calendar no longer wants to show.
Extra Credit: write in a comment how you might write tests for this user flow
Modify the DatePicker component to have two new fields, StartDate and EndDate
- Since we are not allowing the user to type in a start date or an end date, I would write unit tests for these scenarios:
-
- user choosing first a start date and then an end date by clicking on the start date field, then selecting a range of dates in the calendar popup (the
ReactDayPickercomponent).
- user choosing first a start date and then an end date by clicking on the start date field, then selecting a range of dates in the calendar popup (the
-
- user leaving start date alone and just picking a new end date by clicking on the end date field, then choosing a new end date that is after the start date.
-
- if the user clicks the end date field, but chooses a date prior to the current selected start date, make that the new start date and allow the user to choose a new end date.
-
- if the user has chosen a start date that is not the current month, when the user clicks the start date field to update the start date, the calendar popup should pop up on the current selected date's month, not the current month. The same goes for the end date field.
-
- clicking outside the calendar popup closes the popup.
-
- I would write an integration test for:
-
- when the user opens the calendar popup, the popup should push the rest of the modal down, not just cover it.
-
For the DatePicker component style changes:
- Modify text color styles...
- White (#FFFFFF) when a date is provided (pls confirm w/ design)
- I left this as the default (#ececec) because that is what is called out in
src/theme/colors.jsastextSecondaryLightand I felt it was the most appropriate color choice.
- I left this as the default (#ececec) because that is what is called out in
TextSecondaryLightwhen a date is not provided- I used
textSecondaryDarkwhen a date is not provided here, as it matched better with the Figma files and attached screenshots.
- I used
- White (#FFFFFF) when a date is provided (pls confirm w/ design)
For this bit: previous and next arrows should be PrimaryFocus from theme/colors.js:
- changing the colors was challenging because the provided arrows from React's
DayPickercomponent (what we were using) are actually images.- to avoid writing my own
DayPickercomponent, I used CSS filters to change the color. I actually found a tool that someone made where you input a target color as a hex code, and it outputs what filters to use. https://codepen.io/sosuke/pen/Pjoqqp
- to avoid writing my own
Screenshots of Final Product
Collapsed Date Picker
Expanded Date Picker with Focused Start Date Field
Expanded Date Picker with Focused End Date Field
Danielle demoed latest version of datepicker updates. My review notes:
- [ ] after selecting a StartDate, I noticed that the End Date form field was not highlighted. This would lead to confusion on whether the user needs to click on the End Date form field in order to proceed
- [ ] instead, selecting the StartDate should then focus the End Date form field, so that it is clear that the user should select an EndDate
Danielle demoed latest version of datepicker updates. My review notes:
- [x] after selecting a StartDate, I noticed that the End Date form field was not highlighted. This would lead to confusion on whether the user needs to click on the End Date form field in order to proceed
- [x] instead, selecting the StartDate should then focus the End Date form field, so that it is clear that the user should select an EndDate
Screenshot of focusing EndDate
@ryanfchase I've got this functionality added, thanks for the review! PR is here: #2060