UNPKG

@modern-kit/utils

Version:
19 lines (16 loc) 541 B
import { parseDateString } from '../parseDateString/index.mjs'; const parseDate = (date) => { let dateToUse = null; if (typeof date === "string") { dateToUse = new Date(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; }; export { parseDate }; //# sourceMappingURL=index.mjs.map