A module to judge whether it is within one year
JavaScript
Latest commit cd654c4 Jan 11, 2017 @kjirou 1.0.1
Permalink
Failed to load latest commit information.
test
.gitignore
README.md Update texts Jan 11, 2017
index.js Create the module Jan 11, 2017
package.json

README.md

within-one-year

npm version

A module to judge whether it is within one year

Installation

npm install within-one-year

Usage

const withinOneYear = require('within-one-year');

const from = new Date('2017-01-01T00:00:00.000Z');
console.log(withinOneYear(from, new Date('2018-01-01T00:00:00.000Z')));  // -> true
console.log(withinOneYear(from, new Date('2018-01-01T00:00:00.001Z')));  // -> false

Interpretation of leap years

  • 2016-02-29 + 1 year => 2017-03-01
  • 2015-03-01 + 1 year => 2016-03-01
  • 2015-02-28 + 1 year => 2016-02-28