blob: 7116c69027022323e41130f384db7cc3d35709f9 [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001'use strict';
2
3var modulo = require('./modulo');
4
5// https://262.ecma-international.org/5.1/#sec-15.9.1.3
6
7module.exports = function DaysInYear(y) {
8 if (modulo(y, 4) !== 0) {
9 return 365;
10 }
11 if (modulo(y, 100) !== 0) {
12 return 366;
13 }
14 if (modulo(y, 400) !== 0) {
15 return 365;
16 }
17 return 366;
18};