UNPKG

tdesign-react

Version:
91 lines (85 loc) 2.65 kB
/** * tdesign v1.16.6 * (c) 2026 tdesign * @license MIT */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var slicedToArray = require('../_chunks/dep-3281986a.js'); var format = require('../_chunks/dep-a12038f7.js'); var isNil = require('../_chunks/dep-d1066fe4.js'); require('../_chunks/dep-54373955.js'); require('../_chunks/dep-ef5bfcf1.js'); require('dayjs'); require('../_chunks/dep-20f09a63.js'); require('../_chunks/dep-f2e56581.js'); require('../_chunks/dep-ed99b2c6.js'); require('../_chunks/dep-202d6c73.js'); require('../_chunks/dep-615c149d.js'); require('../_chunks/dep-90a93885.js'); require('../_chunks/dep-a8d5081a.js'); require('../_chunks/dep-0173c82c.js'); require('../_chunks/dep-723e29d6.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$1, times) { if (isNil.isNil(value)) { return null; } var dayjs = format.parseToDayjs(value, format$1); if (times) { var _times = slicedToArray._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" }; exports.dateCorrection = dateCorrection; exports.parseToDateTime = parseToDateTime; exports.triggerMap = triggerMap; //# sourceMappingURL=utils.js.map