DaysInYear.js 301 B

123456789101112131415161718
  1. 'use strict';
  2. var modulo = require('./modulo');
  3. // https://262.ecma-international.org/5.1/#sec-15.9.1.3
  4. module.exports = function DaysInYear(y) {
  5. if (modulo(y, 4) !== 0) {
  6. return 365;
  7. }
  8. if (modulo(y, 100) !== 0) {
  9. return 366;
  10. }
  11. if (modulo(y, 400) !== 0) {
  12. return 365;
  13. }
  14. return 366;
  15. };