date helpers to range, group, aggregate collections
Using npm:
npm install datepress
In Node.js:
const DP = require('datepress');
const moment = require('moment');
let start = new Date();
let end = moment(start).add(10, 'days').toDate();
let delimiter = 'days';
let dates = DP.range(start, end, delimiter);
console.log(dates);
console.log(DP.groupBy(dates, 'days'));
DP.findIndex(collection, date, access);
access is function used to get the date from a item of the collection. If not provided it defaults to identity function.
DP.slice(collection, start, end, access);
DP.batch(collection, delimiter, access);
Returns batches from collection by provided delimiter. A delimiter parameter can be input known from moment.js like 'days', 'minutes',...
MIT © Andre Stehle