UNPKG

tdesign-react

Version:
83 lines (77 loc) 2.43 kB
/** * tdesign v1.13.2 * (c) 2025 tdesign * @license MIT */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var slicedToArray = require('../_chunks/dep-e17e2d31.js'); var format = require('../_chunks/dep-1c372799.js'); var isNil = require('../_chunks/dep-a8126ca9.js'); require('../_chunks/dep-b7d577ac.js'); require('dayjs'); require('../_chunks/dep-ac58e1cc.js'); require('../_chunks/dep-4bc3c0ab.js'); require('../_chunks/dep-3e2d2665.js'); require('../_chunks/dep-f0379c5f.js'); require('../_chunks/dep-6d4d8660.js'); require('../_chunks/dep-028b759d.js'); require('../_chunks/dep-ddacd27a.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(); } exports.dateCorrection = dateCorrection; exports.parseToDateTime = parseToDateTime; //# sourceMappingURL=utils.js.map