Overview
Apple's internal tools often require sophisticated date management. Imagine a scheduling application where users need to select a date range for a new project, but also quickly see existing commitments or resource availability within that period. This problem challenges you to build a robust and intuitive date range picker that integrates event data directly into the calendar view, enhancing user decision-making.
What you need to do / Task
- Implement a calendar component that displays a single month view.
- Allow users to select a start date and an end date, forming a range.
- Display a visual indication (e.g., a colored dot or border) on days that have one or more events, regardless of whether they are selected.
- Clearly highlight the selected date range within the calendar view.
- Below the calendar, display a summary of events occurring within the currently selected date range.
- Provide navigation controls (e.g., "Previous Month", "Next Month") to change the displayed month.
UI/UX expectations
- Layout: A single calendar grid for the current month. Navigation buttons above. Selected range summary below.
- Interactions:
- Clicking a date: If no range is selected, it becomes the start date. If a start date is selected but no end date, clicking another date sets it as the end date (re-ordering if the clicked date is earlier than the start date). If a full range (start and end) is already selected, clicking a date clears the previous range and sets the clicked date as the new start date.
- Hovering over dates: Visually indicate potential end date selection when a start date is already picked.
- Navigation buttons: Smooth transition to adjacent months.
- Accessibility:
- Keyboard navigation for calendar days and month controls (e.g., Tab, Arrow keys).
- Clear ARIA labels for interactive elements.
- Sufficient contrast for selected states and event indicators.
Acceptance criteria
- [ ] Calendar displays days of the month correctly, including days from previous/next months to fill the grid.
- [ ] Navigation buttons correctly change the displayed month.
- [ ] Days with events are visually distinct (e.g., a small dot, border, or background color).
- [ ] Users can select a start date and an end date.
- [ ] The selected date range is clearly highlighted in the calendar.
- [ ] Selecting an end date before the start date correctly re-orders the range (e.g., if you click Oct 10 then Oct 5, the range should be Oct 5 - Oct 10).
- [ ] A summary of events within the selected range is displayed below the calendar.
- [ ] All interactive elements (days, navigation buttons) are keyboard navigable.
- [ ] UI states (selected, hovered, event-day) have sufficient contrast.