UNPKG

@technobuddha/library

Version:
25 lines (24 loc) 1.13 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.isSameWeek = void 0; var constants_1 = require("../constants"); var getBeginningOfWeek_1 = __importDefault(require("../getBeginningOfWeek")); /** * Determine if two dates occur in the same week * * @param input1 The first date * @param input2 The second date * @param __namedParameters see {@link Options} * @default UTC false * @default firstDayOfWeek Sunday * @returns true, if the two dates occur in the same week */ function isSameWeek(input1, input2, _a) { var _b = _a === void 0 ? {} : _a, _c = _b.UTC, UTC = _c === void 0 ? false : _c, _d = _b.firstDayOfWeek, firstDayOfWeek = _d === void 0 ? constants_1.day.sunday : _d; return getBeginningOfWeek_1.default(input1, { UTC: UTC, firstDayOfWeek: firstDayOfWeek }).getTime() === getBeginningOfWeek_1.default(input2, { UTC: UTC, firstDayOfWeek: firstDayOfWeek }).getTime(); } exports.isSameWeek = isSameWeek; exports.default = isSameWeek;