UNPKG

563 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.toDate = exports.iso8601 = void 0;
4const iso8601 = (time) => (0, exports.toDate)(time)
5 .toISOString()
6 .replace(/\.\d{3}Z$/, "Z");
7exports.iso8601 = iso8601;
8const toDate = (time) => {
9 if (typeof time === "number") {
10 return new Date(time * 1000);
11 }
12 if (typeof time === "string") {
13 if (Number(time)) {
14 return new Date(Number(time) * 1000);
15 }
16 return new Date(time);
17 }
18 return time;
19};
20exports.toDate = toDate;