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) 553 B
import toDate from '../../toDate/index.js'; // See issue: https://github.com/date-fns/date-fns/issues/376 function startOfUTCISOWeek(dirtyDate) { if (arguments.length < 1) { throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); } 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; } export default startOfUTCISOWeek;