import getTimezoneOffsetInMilliseconds from '../_lib/getTimezoneOffsetInMilliseconds/index' ; import startOfISOWeek from '../startOfISOWeek/index' ; import requiredArgs from '../_lib/requiredArgs/index' ; const MILLISECONDS_IN_WEEK = 604800000 ; name category summary description param { Date | Number } dateLeft param { Date | Number } dateRight returns { Number } throws example export default function differenceInCalendarISOWeeks ( dirtyDateLeft , dirtyDateRight ) { requiredArgs ( 2 , arguments ) ; const startOfISOWeekLeft = startOfISOWeek ( dirtyDateLeft ) ; const startOfISOWeekRight = startOfISOWeek ( dirtyDateRight ) ; const timestampLeft = startOfISOWeekLeft . getTime ( ) - getTimezoneOffsetInMilliseconds ( startOfISOWeekLeft ) ; const timestampRight = startOfISOWeekRight . getTime ( ) - getTimezoneOffsetInMilliseconds ( startOfISOWeekRight ) ; return Math . round ( ( timestampLeft - timestampRight ) / MILLISECONDS_IN_WEEK ) ; }