hugoWebsite/node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js
Jeremy Nusser 0ab675d92b Initial commit... 🎉🎉🎉
2022-10-28 17:20:35 -05:00

12 lines
No EOL
476 B
JavaScript

import toInteger from "../toInteger/index.js";
import toDate from "../../toDate/index.js";
import getUTCISOWeek from "../getUTCISOWeek/index.js";
import requiredArgs from "../requiredArgs/index.js";
export default function setUTCISOWeek(dirtyDate, dirtyISOWeek) {
requiredArgs(2, arguments);
var date = toDate(dirtyDate);
var isoWeek = toInteger(dirtyISOWeek);
var diff = getUTCISOWeek(date) - isoWeek;
date.setUTCDate(date.getUTCDate() - diff * 7);
return date;
}