index.js 650 B

1234567891011121314
  1. import getUTCISOWeekYear from "../getUTCISOWeekYear/index.js";
  2. import startOfUTCISOWeek from "../startOfUTCISOWeek/index.js";
  3. import requiredArgs from "../requiredArgs/index.js"; // This function will be a part of public API when UTC function will be implemented.
  4. // See issue: https://github.com/date-fns/date-fns/issues/376
  5. export default function startOfUTCISOWeekYear(dirtyDate) {
  6. requiredArgs(1, arguments);
  7. var year = getUTCISOWeekYear(dirtyDate);
  8. var fourthOfJanuary = new Date(0);
  9. fourthOfJanuary.setUTCFullYear(year, 0, 4);
  10. fourthOfJanuary.setUTCHours(0, 0, 0, 0);
  11. var date = startOfUTCISOWeek(fourthOfJanuary);
  12. return date;
  13. }