Files
discord-decomp/_bundle/formatISO9075.js
T
2026-11-01 12:12:55 +02:00

63 lines
2.3 KiB
JavaScript

// Metro module 3524 (f3525).
import * as _toDate from "./toDate";
import { __esModule } from "./toDate";
import * as _isValid from "./isValid";
import * as _addLeadingZeros from "./addLeadingZeros";
let c1876_0, c1876_1, c1876_2;
export default function formatISO9075(a0, a1) {
if (arguments.length < 1) {
throw new TypeError("1 argument required, but only ".concat(arguments.length, " present"));
}
const r14 = (0, c1876_0.default)(a0);
if ((0, c1876_1.default)(r14)) {
const r11 = String;
const format = a1?.format;
const r32 = r11(format !== null ? format !== void 0 ? format : "extended" : "extended");
const r33 = String;
const representation = a1?.representation;
const r37 = r33(representation !== null ? representation !== void 0 ? representation : "complete" : "complete");
if (r32 !== "extended" && r32 !== "basic") {
throw new RangeError("format must be 'extended' or 'basic'");
}
const r40 = r37 !== "date";
if (r40 && r37 !== "time" && r37 !== "complete") {
throw new RangeError("representation must be 'date', 'time', or 'complete'");
}
const r42 = r32 === "extended";
const r43 = r42 ? "-" : "";
const r44 = r42 ? ":" : "";
let r46 = "";
if (r37 !== "time") {
const r51 = (0, c1876_2.default)(r14.getDate(), 2);
const r55 = (0, c1876_2.default)(r14.getMonth() + 1, 2);
r46 = "".concat((0, c1876_2.default)(r14.getFullYear(), 4)).concat(r43).concat(r55).concat(r43).concat(r51);
}
let r70 = r46;
if (r40) {
const r76 = (0, c1876_2.default)(r14.getHours(), 2);
const r80 = (0, c1876_2.default)(r14.getMinutes(), 2);
const r84 = (0, c1876_2.default)(r14.getSeconds(), 2);
const r85 = r46 === "" ? "" : " ";
r70 = "".concat(r46).concat(r85).concat(r76).concat(r44).concat(r80).concat(r44).concat(r84);
}
return r70;
}
throw new RangeError("Invalid time value");
};
c1876_0 = _toDate ? __esModule ? _toDate : {
default: _toDate
} : {
default: _toDate
};
c1876_1 = _isValid ? _isValid.__esModule ? _isValid : {
default: _isValid
} : {
default: _isValid
};
c1876_2 = _addLeadingZeros ? _addLeadingZeros.__esModule ? _addLeadingZeros : {
default: _addLeadingZeros
} : {
default: _addLeadingZeros
};
module.exports = exports.default;