import getWeek from '../getWeek/index' ; import toDate from '../toDate/index' ; import type { FirstWeekContainsDateOptions , LocaleOptions , WeekStartOptions , } from '../types' ; import requiredArgs from '../_lib/requiredArgs/index' ; import toInteger from '../_lib/toInteger/index' ; name category summary description param { Date | Number } date param { Number } week param options param { Locale } options . locale - the locale object. See [Locale] https param { 0 | 1 | 2 | 3 | 4 | 5 | 6 } options . weekStartsOn param { 1 | 2 | 3 | 4 | 5 | 6 | 7 } options . firstWeekContainsDate returns { Date } throws throws throws example example export default function setWeek ( dirtyDate , dirtyWeek , options ? ) { requiredArgs ( 2 , arguments ) ; const date = toDate ( dirtyDate ) ; const week = toInteger ( dirtyWeek ) ; const diff = getWeek ( date , options ) - week ; date . setDate ( date . getDate ( ) - diff * 7 ) ; return date ; }