UNPKG

jobiqo-cl

Version:

[![CircleCI](https://circleci.com/gh/jobiqo/jobiqo-cl.svg?style=svg&circle-token=5a24efa5b8bbc4879276123e77d0d3f35ca7144c)](https://circleci.com/gh/jobiqo/jobiqo-cl)

20 lines (15 loc) 601 B
import toDate from '../../toDate/index.js'; import toInteger from '../toInteger/index.js'; import getUTCISOWeek from '../getUTCISOWeek/index.js'; // See issue: https://github.com/date-fns/date-fns/issues/376 function setUTCISOWeek(dirtyDate, dirtyISOWeek) { if (arguments.length < 2) { throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); } var date = toDate(dirtyDate); var isoWeek = toInteger(dirtyISOWeek); var diff = getUTCISOWeek(date) - isoWeek; date.setUTCDate(date.getUTCDate() - diff * 7); return date; } export default setUTCISOWeek;