Let's talk about date-range picker - it's just one part of a reporting filter. Seems easy, right? But the app still needs to decide when a selection takes effect, what “Last 7 days” includes, and what happens when someone requests a range the report cannot support.
We are going to build a simple React app with fictional invoice data, a revenue total, two presets and an explicit Apply filters action.
Expected: four invoices totaling $4,000.00 . Choosing This month changes the selected dates; pressing Apply filters changes the report to seven invoices totaling $5,330.00 . That distinction is the main idea of the implementation.
Define the reporting rules
The example uses these rules:
Dates are normalized YYYY-MM-DD business dates, not timestamps.
Both endpoints are included.…