0.3.0 • Published 5 years ago
@ladjs/simple-recur v0.3.0
simple-recur
Calculate date recurrence. A great alternative to moment-recur and later.
Install
npm install simple-recur
Options
units
(Number)measure
('weeks', 'months', 'years')start
(Date)from
(Date)
Examples
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 boolean
Test
npm test
Build
npm run build
Watch
npm run watch
0.3.0
5 years ago