function dayOfYear(date) {
  // Values from 0 to 99 map to the years 1900 to 1999. All other values are the actual year. (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date)
  // Using setFullYear as a workaround
  const yearStart = new Date(date);
  yearStart.setFullYear(date.getFullYear(), 0, 0);
  const diff = date.getTime() - yearStart.getTime() +
    (yearStart.getTimezoneOffset() - date.getTimezoneOffset()) * 60 * 1000;
  return Math.floor(diff / DAY);
}
/**
 * Get number of the day in the year
 * @return Number of the day in year
 */
Get number of the day in the year
@return Number of the day in year
Get number of the day in the year @return Number of the day in year
function dayOfYear(date) {
  const yearStart = new Date(date);
  yearStart.setFullYear(date.getFullYear(), 0, 0);
  const diff = date.getTime() - yearStart.getTime() +
    (yearStart.getTimezoneOffset() - date.getTimezoneOffset()) * 60 * 1000;
  return Math.floor(diff / DAY);
}
function dayOfYear ( date ) { const yearStart = new Date ( date ) ; yearStart . setFullYear ( date . getFullYear ( ) , 0 , 0 ) ; const diff = date . getTime ( ) - yearStart . getTime ( ) + ( yearStart . getTimezoneOffset ( ) - date . getTimezoneOffset ( ) ) * 60 * 1000 ; return Math . floor ( diff / DAY ) ; }
Get number of the day in the year
 @return Number of the day in year
Get number of the day in the year @return Number of the day in year
// Values from 0 to 99 map to the years 1900 to 1999. All other values are the actual year. (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date) // Using setFullYear as a workaround