Stripe Date Picker Component
Stripe users often need to schedule payments, subscriptions, or generate reports for specific dates. A robust and intuitive date picker is crucial for a smooth user experience, ensuring accuracy and reducing errors in financial operations. This problem focuses on building a core DatePicker component that allows users to select a single date from a calendar view.
Your task is to implement a DatePicker React component with the following features:
DatePicker should render as an input field. Clicking or focusing on this input field should reveal a calendar UI in a popover.YYYY-MM-DD) and close the popover.today).today) should be visually disabled and not selectable.DatePicker should primarily consist of an <input type="text" readOnly /> element. The calendar UI should appear as a popover positioned relative to the input when active.Escape key (when popover is open) should close it.readOnly to prevent manual date entry and encourage calendar usage. Focus management for the popover is not strictly required beyond closing on Escape and outside clicks.YYYY-MM-DD format and visually highlights the selected date in the calendar.Escape key closes the calendar popover.Constraints
Date objects for all date calculations and manipulations. Avoid using external date utility libraries like moment.js or date-fns.Date objects for navigation, comparisons, and formatting.Loading editor...