decord/source/3212_startOfUTCWeek.js

81 lines
2.2 KiB
JavaScript
Raw Normal View History

2026-07-23 10:11:24 +00:00
// Module ID: 3212
2026-07-24 07:16:23 +00:00
// Function ID: 25831
2026-07-20 16:05:17 +00:00
// Name: startOfUTCWeek
2026-07-23 10:11:24 +00:00
// Dependencies: [3209, 3210, 3213, 3214]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-07-23 10:11:24 +00:00
// Module 3212 (startOfUTCWeek)
import _typeof from "_typeof";
import requiredArgs from "requiredArgs";
import toInteger from "toInteger";
2026-07-20 16:05:17 +00:00
export default function startOfUTCWeek(defaultResult1, weekStartsOn) {
2026-07-23 10:11:24 +00:00
requiredArgs.default(1, arguments);
const defaultOptions = require(3214) /* getDefaultOptions */.getDefaultOptions();
2026-07-20 16:05:17 +00:00
weekStartsOn = undefined;
if (null != weekStartsOn) {
weekStartsOn = weekStartsOn.weekStartsOn;
}
if (null === weekStartsOn) {
let weekStartsOn1;
if (null != weekStartsOn) {
const locale = weekStartsOn.locale;
if (null !== locale) {
if (undefined !== locale) {
const options = locale.options;
if (null !== options) {
if (undefined !== options) {
weekStartsOn1 = options.weekStartsOn;
}
}
}
}
}
weekStartsOn = weekStartsOn1;
}
if (null === weekStartsOn) {
weekStartsOn = defaultOptions.weekStartsOn;
}
if (null === weekStartsOn) {
const locale2 = defaultOptions.locale;
let weekStartsOn2;
if (null !== locale2) {
if (undefined !== locale2) {
const options2 = locale2.options;
if (null !== options2) {
if (undefined !== options2) {
weekStartsOn2 = options2.weekStartsOn;
}
}
}
}
weekStartsOn = weekStartsOn2;
}
let num = 0;
if (null !== weekStartsOn) {
num = 0;
if (undefined !== weekStartsOn) {
num = weekStartsOn;
}
}
2026-07-23 10:11:24 +00:00
defaultResult1 = toInteger.default(num);
2026-07-20 16:05:17 +00:00
if (defaultResult1 >= 0) {
if (defaultResult1 <= 6) {
2026-07-23 10:11:24 +00:00
const defaultResult2 = _typeof.default(defaultResult1);
2026-07-20 16:05:17 +00:00
const uTCDay = defaultResult2.getUTCDay();
let num3 = 0;
if (uTCDay < defaultResult1) {
num3 = 7;
}
const diff = num3 + uTCDay - defaultResult1;
defaultResult2.setUTCDate(defaultResult2.getUTCDate() - diff);
defaultResult2.setUTCHours(0, 0, 0, 0);
return defaultResult2;
}
}
const rangeError = new RangeError("weekStartsOn must be between 0 and 6 inclusively");
throw rangeError;
};
export default exports.default;