index.js 538 B

123456789101112131415161718192021222324
  1. var parse = require('../parse/index.js')
  2. /**
  3. * @category Weekday Helpers
  4. * @summary Get the day of the week of the given date.
  5. *
  6. * @description
  7. * Get the day of the week of the given date.
  8. *
  9. * @param {Date|String|Number} date - the given date
  10. * @returns {Number} the day of week
  11. *
  12. * @example
  13. * // Which day of the week is 29 February 2012?
  14. * var result = getDay(new Date(2012, 1, 29))
  15. * //=> 3
  16. */
  17. function getDay (dirtyDate) {
  18. var date = parse(dirtyDate)
  19. var day = date.getDay()
  20. return day
  21. }
  22. module.exports = getDay