* Reverse the boundary normalization so the calendar highlights the * inclusive end date the user originally selected, not the exclusive * API boundary. Midnight boundaries get shifted back by one day; * sub-day boundaries (today's rounded-up hour) stay on the same day.
(value: DateRangeValue)
| 107 | * sub-day boundaries (today's rounded-up hour) stay on the same day. |
| 108 | */ |
| 109 | function fromBoundary(value: DateRangeValue): DayPickerDateRange { |
| 110 | const from = dayjs(value.startDate).startOf("day").toDate(); |
| 111 | const endDayjs = dayjs(value.endDate); |
| 112 | const to = endDayjs.isSame(endDayjs.startOf("day")) |
| 113 | ? endDayjs.subtract(1, "day").toDate() |
| 114 | : endDayjs.toDate(); |
| 115 | return { from, to }; |
| 116 | } |
| 117 | |
| 118 | export const DateRangePicker: FC<DateRangePickerProps> = ({ |
| 119 | value, |
no outgoing calls
no test coverage detected