25 lines
732 B
JavaScript
25 lines
732 B
JavaScript
|
"use strict";
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.default = startOfUTCISOWeek;
|
||
|
|
||
|
var _index = _interopRequireDefault(require("../../toDate/index.js"));
|
||
|
|
||
|
var _index2 = _interopRequireDefault(require("../requiredArgs/index.js"));
|
||
|
|
||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
|
||
|
function startOfUTCISOWeek(dirtyDate) {
|
||
|
(0, _index2.default)(1, arguments);
|
||
|
var weekStartsOn = 1;
|
||
|
var date = (0, _index.default)(dirtyDate);
|
||
|
var day = date.getUTCDay();
|
||
|
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
||
|
date.setUTCDate(date.getUTCDate() - diff);
|
||
|
date.setUTCHours(0, 0, 0, 0);
|
||
|
return date;
|
||
|
}
|
||
|
|
||
|
module.exports = exports.default;
|