MCPcopy Create free account
hub / github.com/coder/coder / fromBoundary

Function fromBoundary

site/src/components/DateRangePicker/DateRangePicker.tsx:109–116  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

107 * sub-day boundaries (today's rounded-up hour) stay on the same day.
108 */
109function 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
118export const DateRangePicker: FC<DateRangePickerProps> = ({
119 value,

Callers 2

DateRangePickerFunction · 0.85
handleOpenChangeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected