import toDate from '../../toDate/index' ; import startOfUTCWeek from '../startOfUTCWeek/index' ; import startOfUTCWeekYear from '../startOfUTCWeekYear/index' ; import requiredArgs from '../requiredArgs/index' ; import type { LocaleOptions , WeekStartOptions , FirstWeekContainsDateOptions , } from '../../types' ; const MILLISECONDS_IN_WEEK = 604800000 ; export default function getUTCWeek ( dirtyDate , options ? ) { requiredArgs ( 1 , arguments ) ; const date = toDate ( dirtyDate ) ; const diff = startOfUTCWeek ( date , options ) . getTime ( ) - startOfUTCWeekYear ( date , options ) . getTime ( ) ; return Math . round ( diff / MILLISECONDS_IN_WEEK ) + 1 ; }