UNPKG

fui-fancyui

Version:
29 lines (28 loc) 801 B
import { useState as m, useCallback as D } from "react"; import { selectDayRange as u } from "../selectDayRange/selectDayRange.js"; function S(t) { const { handleDates: e, rangeCalendar: i } = t, [c, o] = m([void 0, void 0]), d = D( (a, l, n) => { if (i) { const r = u({ day: a, monthIndex: l, selectedDates: c, selectedYear: n, selectFromTo: t.selectFromTo, handleSwitchFromTo: t.handleSwitchFromTo }); o(r), e == null || e(r); } else { const s = new Date(n, l, a.number); o(s), e == null || e(s); } }, // eslint-disable-next-line react-hooks/exhaustive-deps [c, t.selectFromTo] ); return { selectedDates: c, handleDateClick: d }; } export { S as default };