105 lines
2.7 KiB
JavaScript
105 lines
2.7 KiB
JavaScript
// Module ID: 3850
|
|
// Function ID: 3851
|
|
// Name: lastDayOfWeek
|
|
// Dependencies: [3476, 3480, 3477, 3481]
|
|
// Exports: default
|
|
|
|
// Module 3850 (lastDayOfWeek)
|
|
import getDefaultOptions from "getDefaultOptions" /* 3481 */;
|
|
import _typeof from "_typeof" /* 3476 */;
|
|
import toInteger from "toInteger" /* 3480 */;
|
|
import requiredArgs from "requiredArgs" /* 3477 */;
|
|
|
|
if (!_typeof) {
|
|
let obj = { default: null };
|
|
obj[0] = _typeof;
|
|
let tmp3 = obj;
|
|
} else {
|
|
tmp3 = _typeof;
|
|
}
|
|
_typeof = tmp3;
|
|
if (!toInteger) {
|
|
obj = { default: null };
|
|
obj[0] = toInteger;
|
|
let tmp5 = obj;
|
|
} else {
|
|
tmp5 = toInteger;
|
|
}
|
|
toInteger = tmp5;
|
|
if (!requiredArgs) {
|
|
obj = { default: null };
|
|
obj[0] = requiredArgs;
|
|
let tmp7 = obj;
|
|
} else {
|
|
tmp7 = requiredArgs;
|
|
}
|
|
requiredArgs = tmp7;
|
|
|
|
export default function lastDayOfWeek(arg0, weekStartsOn) {
|
|
requiredArgs.default(1, arguments);
|
|
const defaultOptions = 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;
|
|
}
|
|
}
|
|
const defaultResult1 = toInteger.default(num);
|
|
if (defaultResult1 >= 0) {
|
|
if (defaultResult1 <= 6) {
|
|
const defaultResult2 = _typeof.default(arg0);
|
|
const day = defaultResult2.getDay();
|
|
let num3 = 0;
|
|
if (day < defaultResult1) {
|
|
num3 = -7;
|
|
}
|
|
const diff = 6 + num3 - (day - defaultResult1);
|
|
defaultResult2.setHours(0, 0, 0, 0);
|
|
defaultResult2.setDate(defaultResult2.getDate() + diff);
|
|
return defaultResult2;
|
|
}
|
|
}
|
|
const rangeError = new RangeError("weekStartsOn must be between 0 and 6");
|
|
throw rangeError;
|
|
};
|
|
export default exports.default;
|