80 lines
2.2 KiB
JavaScript
80 lines
2.2 KiB
JavaScript
// Module ID: 3213
|
|
// Function ID: 25843
|
|
// Name: startOfUTCWeek
|
|
// Dependencies: [3210, 3211, 3214, 3215]
|
|
// Exports: default
|
|
|
|
// Module 3213 (startOfUTCWeek)
|
|
import _typeof from "_typeof";
|
|
import requiredArgs from "requiredArgs";
|
|
import toInteger from "toInteger";
|
|
|
|
|
|
export default function startOfUTCWeek(defaultResult1, weekStartsOn) {
|
|
requiredArgs.default(1, arguments);
|
|
const defaultOptions = require(3215) /* getDefaultOptions */.getDefaultOptions();
|
|
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;
|
|
}
|
|
}
|
|
defaultResult1 = toInteger.default(num);
|
|
if (defaultResult1 >= 0) {
|
|
if (defaultResult1 <= 6) {
|
|
const defaultResult2 = _typeof.default(defaultResult1);
|
|
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;
|