UNPKG

@modern-kit/utils

Version:
21 lines (17 loc) 588 B
'use strict'; var dateParseDateString = require('../parseDateString/index.cjs'); const parseDate = (date) => { let dateToUse = null; if (typeof date === "string") { dateToUse = new Date(dateParseDateString.parseDateString(date)); } if (date instanceof Date || typeof date === "number") { dateToUse = new Date(date); } if (dateToUse && isNaN(dateToUse.getTime())) { throw new Error("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uB0A0\uC9DC \uD615\uC2DD\uC785\uB2C8\uB2E4."); } return dateToUse; }; exports.parseDate = parseDate; //# sourceMappingURL=index.cjs.map