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

60 lines
2.3 KiB
JavaScript

// Metro module 3526 (f3527).
import * as _toDate from "./toDate";
import { __esModule } from "./toDate";
import * as _isValid from "./isValid";
import * as _addLeadingZeros from "./addLeadingZeros";
import * as _toInteger from "./toInteger";
let c1878_0, c1878_1, c1878_2, c1878_3;
export default function formatRFC3339(a0, a1) {
if (arguments.length < 1) {
throw new TypeError("1 arguments required, but only ".concat(arguments.length, " present"));
}
const r10 = (0, c1878_0.default)(a0);
if ((0, c1878_1.default)(r10)) {
const r39 = Number;
const fractionDigits = a1?.fractionDigits;
const r22 = r39(fractionDigits !== null ? fractionDigits !== void 0 ? fractionDigits : 0 : 0);
if (r22 >= 0 && r22 <= 3) {
const r16 = (0, c1878_2.default)(r10.getDate(), 2);
const r17 = (0, c1878_2.default)(r10.getMonth() + 1, 2);
const fullYear = r10.getFullYear();
const r15 = (0, c1878_2.default)(r10.getHours(), 2);
const r14 = (0, c1878_2.default)(r10.getMinutes(), 2);
const r12 = (0, c1878_2.default)(r10.getSeconds(), 2);
const r67 = r22 > 0 ? "." + (0, c1878_2.default)(Math.floor(r10.getMilliseconds() * Math.pow(10, r22 - 3)), r22) : "";
const timezoneOffset = r10.getTimezoneOffset();
let r80 = "Z";
if (timezoneOffset !== 0) {
const r83 = Math.abs(timezoneOffset);
const r90 = (0, c1878_2.default)((0, c1878_3.default)(r83 / 60), 2);
const r93 = (0, c1878_2.default)(r83 % 60, 2);
r80 = "".concat.call("", timezoneOffset < 0 ? "+" : "-").concat(r90, ":").concat(r93);
}
return "".concat(fullYear, "-").concat(r17, "-").concat(r16, "T").concat(r15, ":").concat(r14, ":").concat(r12).concat(r67).concat(r80);
}
throw new RangeError("fractionDigits must be between 0 and 3 inclusively");
}
throw new RangeError("Invalid time value");
};
c1878_0 = _toDate ? __esModule ? _toDate : {
default: _toDate
} : {
default: _toDate
};
c1878_1 = _isValid ? _isValid.__esModule ? _isValid : {
default: _isValid
} : {
default: _isValid
};
c1878_2 = _addLeadingZeros ? _addLeadingZeros.__esModule ? _addLeadingZeros : {
default: _addLeadingZeros
} : {
default: _addLeadingZeros
};
c1878_3 = _toInteger ? _toInteger.__esModule ? _toInteger : {
default: _toInteger
} : {
default: _toInteger
};
module.exports = exports.default;