main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
462 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var $EvalError = require('es-errors/eval');
|
---|
| 4 |
|
---|
| 5 | var DaysInYear = require('./DaysInYear');
|
---|
| 6 | var YearFromTime = require('./YearFromTime');
|
---|
| 7 |
|
---|
| 8 | // https://262.ecma-international.org/5.1/#sec-15.9.1.3
|
---|
| 9 |
|
---|
| 10 | module.exports = function InLeapYear(t) {
|
---|
| 11 | var days = DaysInYear(YearFromTime(t));
|
---|
| 12 | if (days === 365) {
|
---|
| 13 | return 0;
|
---|
| 14 | }
|
---|
| 15 | if (days === 366) {
|
---|
| 16 | return 1;
|
---|
| 17 | }
|
---|
| 18 | throw new $EvalError('Assertion failed: there are not 365 or 366 days in a year, got: ' + days);
|
---|
| 19 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.