@veracity/vui
Version:
Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.
22 lines (20 loc) • 746 B
JavaScript
import { isExact, isFrom } from "../utils.js";
//#region src/calendar/hooks/useSelectedDate.ts
/**
* Calculate the selected dates
* If we are in single calendar mode, will use the startDate as selected date
* Memoized so will only recalculate when selectedDates or mode changes
*/
const useSelectedDate = ({ selectedDates, mode }) => {
const currentDateTime = isFrom(mode) || isExact(mode) ? selectedDates?.startDate : selectedDates?.endDate;
const minSelectedDateTime = selectedDates?.startDate || void 0;
return {
currentDateTime,
maxSelectedDateTime: selectedDates?.endDate || void 0,
minSelectedDateTime
};
};
//#endregion
export { useSelectedDate };
globalThis.__vuiVersion__ = "5.3.1"
//# sourceMappingURL=useSelectedDate.js.map