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

71 lines
2.0 KiB
JavaScript

// Metro module 3642 (f3643).
import * as _toDate from "./toDate";
import { __esModule } from "./toDate";
import * as _toInteger from "./toInteger";
import * as _requiredArgs from "./requiredArgs";
import { getDefaultOptions } from "./Module3273";
let c2059_2, c2059_3, c2059_4;
export default function lastDayOfWeek(a0, a1) {
(0, c2059_4.default)(1, arguments);
const r26 = (0, getDefaultOptions)();
const default2 = c2059_3.default;
let r10 = a1?.weekStartsOn;
if (!(r10 !== null && r10 !== void 0)) {
const r29 = a1 == null;
let r11 = void 0;
if (!r29) {
const locale = a1.locale;
r11 = void 0;
if (locale !== null) {
r11 = void 0;
if (locale !== void 0) {
const options = locale.options;
r11 = options !== null ? options !== void 0 ? options.weekStartsOn : void 0 : void 0;
}
}
}
r10 = r11;
}
if (!(r10 !== null && r10 !== void 0)) {
r10 = r26.weekStartsOn;
}
if (!(r10 !== null && r10 !== void 0)) {
const locale2 = r26.locale;
let r33 = void 0;
if (locale2 !== null) {
r33 = void 0;
if (locale2 !== void 0) {
const options2 = locale2.options;
r33 = options2 !== null ? options2 !== void 0 ? options2.weekStartsOn : void 0 : void 0;
}
}
r10 = r33;
}
const r36 = default2(r10 !== null ? r10 !== void 0 ? r10 : 0 : 0);
if (r36 >= 0 && r36 <= 6) {
const r45 = (0, c2059_2.default)(a0);
const day = r45.getDay();
const r52 = 6 + (day < r36 ? -7 : 0) - (day - r36);
r45.setHours(0, 0, 0, 0);
r45.setDate(r45.getDate() + r52);
return r45;
}
throw new RangeError("weekStartsOn must be between 0 and 6");
};
c2059_2 = _toDate ? __esModule ? _toDate : {
default: _toDate
} : {
default: _toDate
};
c2059_3 = _toInteger ? _toInteger.__esModule ? _toInteger : {
default: _toInteger
} : {
default: _toInteger
};
c2059_4 = _requiredArgs ? _requiredArgs.__esModule ? _requiredArgs : {
default: _requiredArgs
} : {
default: _requiredArgs
};
module.exports = exports.default;