hugoWebsite/node_modules/date-fns/_lib/setUTCWeek/index.js

27 lines
842 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = setUTCWeek;
var _index = _interopRequireDefault(require("../toInteger/index.js"));
var _index2 = _interopRequireDefault(require("../../toDate/index.js"));
var _index3 = _interopRequireDefault(require("../getUTCWeek/index.js"));
var _index4 = _interopRequireDefault(require("../requiredArgs/index.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function setUTCWeek(dirtyDate, dirtyWeek, options) {
(0, _index4.default)(2, arguments);
var date = (0, _index2.default)(dirtyDate);
var week = (0, _index.default)(dirtyWeek);
var diff = (0, _index3.default)(date, options) - week;
date.setUTCDate(date.getUTCDate() - diff * 7);
return date;
}
module.exports = exports.default;