hugoWebsite/node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js

12 lines
425 B
JavaScript
Raw Normal View History

2022-10-29 00:20:35 +02:00
import toDate from "../../toDate/index.js";
import requiredArgs from "../requiredArgs/index.js";
export default function startOfUTCISOWeek(dirtyDate) {
requiredArgs(1, arguments);
var weekStartsOn = 1;
var date = toDate(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;
}