function weekOfYear(date) {
  const workingDate = new Date(
    Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()),
  );
  const day = workingDate.getUTCDay();
  const nearestThursday = workingDate.getUTCDate() + Day.Thu -
    (day === Day.Sun ? DAYS_PER_WEEK : day);
  workingDate.setUTCDate(nearestThursday);
  // Get first day of year
  const yearStart = new Date(Date.UTC(workingDate.getUTCFullYear(), 0, 1));
  // return the calculated full weeks to nearest Thursday
  return Math.ceil((workingDate.getTime() - yearStart.getTime() + DAY) / WEEK);
}
/**
 * Get number of the week in the year (ISO-8601)
 * @return Number of the week in year
 */
Get number of the week in the year (ISO-8601)
@return Number of the week in year
Get number of the week in the year ( ISO - 8601 ) @return Number of the week in year
function weekOfYear(date) {
  const workingDate = new Date(
    Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()),
  );
  const day = workingDate.getUTCDay();
  const nearestThursday = workingDate.getUTCDate() + Day.Thu -
    (day === Day.Sun ? DAYS_PER_WEEK : day);
  workingDate.setUTCDate(nearestThursday);
  const yearStart = new Date(Date.UTC(workingDate.getUTCFullYear(), 0, 1));
  return Math.ceil((workingDate.getTime() - yearStart.getTime() + DAY) / WEEK);
}
function weekOfYear ( date ) { const workingDate = new Date ( Date . UTC ( date . getFullYear ( ) , date . getMonth ( ) , date . getDate ( ) ) , ) ; const day = workingDate . getUTCDay ( ) ; const nearestThursday = workingDate . getUTCDate ( ) + Day . Thu - ( day === Day . Sun ? DAYS_PER_WEEK : day ) ; workingDate . setUTCDate ( nearestThursday ) ; const yearStart = new Date ( Date . UTC ( workingDate . getUTCFullYear ( ) , 0 , 1 ) ) ; return Math . ceil ( ( workingDate . getTime ( ) - yearStart . getTime ( ) + DAY ) / WEEK ) ; }
Get number of the week in the year (ISO-8601)
 @return Number of the week in year
Get number of the week in the year ( ISO - 8601 ) @return Number of the week in year
// Get first day of year // return the calculated full weeks to nearest Thursday