Calculate date recurrence. A great alternative to moment-recur and later.
npm install simple-recurunits(Number)measure('weeks', 'months', 'years')start(Date)from(Date)
JavaScript:
const Recur = require('simple-recur');
const recur = new Recur(options);
// check if a given date matches this recurrence
const matches = recur.matches(new Date());
console.log('matches', matches);
// outputs: true/false
// get the next 3 occurrences
const nextThreeOccurrences = recur.next(3);
console.log('nextThreeOccurrences', nextThreeOccurrences);
// outputs: [moment, moment, moment]CoffeeScript:
Recur = require 'simple-recur'
recur = new Recur
recur.every 2, 'month'
recur.next 3
# outputs: [moment, moment, moment]
recur.matches new Date
# outputs a booleannpm testnpm run buildnpm run watch