dayOfTheYear.js 325 B

12345678910111213
  1. var isDate = require('../lang/isDate');
  2. /**
  3. * return the day of the year (1..366)
  4. */
  5. function dayOfTheYear(date){
  6. return (Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()) -
  7. Date.UTC(date.getFullYear(), 0, 1)) / 86400000 + 1;
  8. }
  9. module.exports = dayOfTheYear;