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) 592 B
import toDate from '../../toDate/index.js'; import toInteger from '../toInteger/index.js'; import getUTCWeek from '../getUTCWeek/index.js'; // See issue: https://github.com/date-fns/date-fns/issues/376 function setUTCWeek(dirtyDate, dirtyWeek, options) { if (arguments.length < 2) { throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); } var date = toDate(dirtyDate); var week = toInteger(dirtyWeek); var diff = getUTCWeek(date, options) - week; date.setUTCDate(date.getUTCDate() - diff * 7); return date; } export default setUTCWeek;