import toDate from '../toDate/index' ; import startOfISOWeek from '../startOfISOWeek/index' ; import startOfISOWeekYear from '../startOfISOWeekYear/index' ; import requiredArgs from '../_lib/requiredArgs/index' ; const MILLISECONDS_IN_WEEK = 604800000 ; name category summary description param { Date | Number } date returns { Number } throws example export default function getISOWeek ( dirtyDate ) { requiredArgs ( 1 , arguments ) ; const date = toDate ( dirtyDate ) ; const diff = startOfISOWeek ( date ) . getTime ( ) - startOfISOWeekYear ( date ) . getTime ( ) ; return Math . round ( diff / MILLISECONDS_IN_WEEK ) + 1 ; }