days-in-month.js 250 B

1234567891011121314151617
  1. "use strict";
  2. var getMonth = Date.prototype.getMonth;
  3. module.exports = function () {
  4. switch (getMonth.call(this)) {
  5. case 1:
  6. return this.getFullYear() % 4 ? 28 : 29;
  7. case 3:
  8. case 5:
  9. case 8:
  10. case 10:
  11. return 30;
  12. default:
  13. return 31;
  14. }
  15. };