67 lines
2.4 KiB
JavaScript
67 lines
2.4 KiB
JavaScript
// Metro module 3523 (f3524).
|
|
import * as _toDate from "./toDate";
|
|
import { __esModule } from "./toDate";
|
|
import * as _addLeadingZeros from "./addLeadingZeros";
|
|
import * as _requiredArgs from "./requiredArgs";
|
|
let c1875_0, c1875_1, c1875_2;
|
|
export default function formatISO(a0, a1) {
|
|
(0, c1875_2.default)(1, arguments);
|
|
const r16 = (0, c1875_0.default)(a0);
|
|
if (isNaN(r16.getTime())) {
|
|
throw new RangeError("Invalid time value");
|
|
}
|
|
const r11 = String;
|
|
const format = a1?.format;
|
|
const r35 = r11(format !== null ? format !== void 0 ? format : "extended" : "extended");
|
|
const r36 = String;
|
|
const representation = a1?.representation;
|
|
const r40 = r36(representation !== null ? representation !== void 0 ? representation : "complete" : "complete");
|
|
if (r35 !== "extended" && r35 !== "basic") {
|
|
throw new RangeError("format must be 'extended' or 'basic'");
|
|
}
|
|
const r43 = r40 !== "date";
|
|
if (r43 && r40 !== "time" && r40 !== "complete") {
|
|
throw new RangeError("representation must be 'date', 'time', or 'complete'");
|
|
}
|
|
const r45 = r35 === "extended";
|
|
const r47 = r45 ? "-" : "";
|
|
const r14 = r45 ? ":" : "";
|
|
let r49 = "";
|
|
if (r40 !== "time") {
|
|
const r54 = (0, c1875_1.default)(r16.getDate(), 2);
|
|
const r58 = (0, c1875_1.default)(r16.getMonth() + 1, 2);
|
|
r49 = "".concat((0, c1875_1.default)(r16.getFullYear(), 4)).concat(r47).concat(r58).concat(r47).concat(r54);
|
|
}
|
|
let r73 = r49;
|
|
if (r43) {
|
|
const timezoneOffset = r16.getTimezoneOffset();
|
|
let r76 = "Z";
|
|
if (timezoneOffset !== 0) {
|
|
const r80 = Math.abs(timezoneOffset);
|
|
const r85 = (0, c1875_1.default)(Math.floor(r80 / 60), 2);
|
|
const r88 = (0, c1875_1.default)(r80 % 60, 2);
|
|
r76 = "".concat.call("", timezoneOffset < 0 ? "+" : "-").concat(r85, ":").concat(r88);
|
|
}
|
|
const r97 = r49 === "" ? "" : "T";
|
|
const r114 = [(0, c1875_1.default)(r16.getHours(), 2), (0, c1875_1.default)(r16.getMinutes(), 2), (0, c1875_1.default)(r16.getSeconds(), 2)].join(r14);
|
|
r73 = "".concat(r49).concat(r97).concat(r114).concat(r76);
|
|
}
|
|
return r73;
|
|
};
|
|
c1875_0 = _toDate ? __esModule ? _toDate : {
|
|
default: _toDate
|
|
} : {
|
|
default: _toDate
|
|
};
|
|
c1875_1 = _addLeadingZeros ? _addLeadingZeros.__esModule ? _addLeadingZeros : {
|
|
default: _addLeadingZeros
|
|
} : {
|
|
default: _addLeadingZeros
|
|
};
|
|
c1875_2 = _requiredArgs ? _requiredArgs.__esModule ? _requiredArgs : {
|
|
default: _requiredArgs
|
|
} : {
|
|
default: _requiredArgs
|
|
};
|
|
module.exports = exports.default;
|