UNPKG

tdesign-vue-next

Version:
77 lines (73 loc) 2.18 kB
/** * tdesign v1.19.2 * (c) 2026 tdesign * @license MIT */ import _slicedToArray from '@babel/runtime/helpers/slicedToArray'; import { isNil } from 'lodash-es'; import { p as parseToDayjs } from '../../_chunks/dep-dc276a19.js'; import 'dayjs'; import '../../_chunks/dep-f0f392fb.js'; import '../../_chunks/dep-4c859e6d.js'; import '../../_chunks/dep-06660d60.js'; function dateCorrection(partialIndex, preYear, preMonth, onlyYearSelect) { var nextYear = preYear; var nextMonth = preMonth; if (partialIndex === 0) { if (nextYear[1] <= nextYear[0]) { if (onlyYearSelect) nextYear[1] = nextYear[0] + 1;else { nextYear[1] = nextYear[0]; if (nextMonth[1] <= nextMonth[0]) { nextMonth[1] = nextMonth[0] + 1; if (nextMonth[1] === 12) { nextMonth[1] = 0; nextYear = [nextYear[0], nextYear[1] + 1]; } } } } } if (partialIndex === 1) { if (nextYear[0] >= nextYear[1]) { if (onlyYearSelect) nextYear[0] = nextYear[1] - 1;else { nextYear[0] = nextYear[1]; if (nextMonth[0] >= nextMonth[1]) { nextMonth[0] = nextMonth[1] - 1; if (nextMonth[0] === -1) { nextMonth[0] = 11; nextYear = [nextYear[0] - 1, nextYear[1]]; } } } } } return { nextYear: nextYear, nextMonth: nextMonth }; } function parseToDateTime(value, format, times) { if (isNil(value)) { return null; } var dayjs = parseToDayjs(value, format); if (times) { var _times = _slicedToArray(times, 4), _times$ = _times[0], hour = _times$ === void 0 ? 0 : _times$, _times$2 = _times[1], minute = _times$2 === void 0 ? 0 : _times$2, _times$3 = _times[2], second = _times$3 === void 0 ? 0 : _times$3, _times$4 = _times[3], millisecond = _times$4 === void 0 ? 0 : _times$4; dayjs = dayjs.hour(hour).minute(minute).second(second).millisecond(millisecond); } return dayjs.toDate(); } var triggerMap = { prev: "arrow-previous", next: "arrow-next" }; export { dateCorrection, parseToDateTime, triggerMap }; //# sourceMappingURL=index.js.map