import getISOWeekYear from '../getISOWeekYear/index' ; import startOfISOWeek from '../startOfISOWeek/index' ; import requiredArgs from '../_lib/requiredArgs/index' ; name category summary description param { Date | Number } date returns { Date } throws example export default function endOfISOWeekYear ( dirtyDate ) { requiredArgs ( 1 , arguments ) ; const year = getISOWeekYear ( dirtyDate ) ; const fourthOfJanuaryOfNextYear = new Date ( 0 ) ; fourthOfJanuaryOfNextYear . setFullYear ( year + 1 , 0 , 4 ) ; fourthOfJanuaryOfNextYear . setHours ( 0 , 0 , 0 , 0 ) ; const date = startOfISOWeek ( fourthOfJanuaryOfNextYear ) ; date . setMilliseconds ( date . getMilliseconds ( ) - 1 ) ; return date ; }