month-ends
Purposefully simple and dependency free functions for calendar months
Usage
monthEnds
const monthEnds = ;const start = '2015-01-02';const end = '2015-04-12';consoledir;// [ [ 2015-01-01T05:00:00.000Z, 2015-01-31T05:00:00.000Z ],// [ 2015-02-01T05:00:00.000Z, 2015-02-28T05:00:00.000Z ],// [ 2015-03-01T05:00:00.000Z, 2015-03-31T04:00:00.000Z ],// [ 2015-04-01T04:00:00.000Z, 2015-04-30T04:00:00.000Z ] ]
lastDayOfMonth
const lastDayOfMonth = ;let anyDay = '2015-06-07';let end = ;consoledirend;// 'Tue Jun 30 2015'
firstDayOfMonth
const firstDayOfMonth = ;let anyDay = '2015-06-07';let end = ;consoledirend;// 'Mon Jun 01 2015'
firstDayOfNextMonth
const firstDayOfNextMonth = ;let anyDay = '2015-06-07';let end = ;consoledirend;// 'Wed Jul 01 2015'
Tests
Tests are written with mocha
, assume
, and nyc
. They can be run with
npm
:
npm test// ...// ...// ...11 passing----------|----------|----------|----------|----------|----------------|File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |----------|----------|----------|----------|----------|----------------|All files | 95.45 | 83.33 | 100 | 100 | |index.js | 95.45 | 83.33 | 100 | 100 | 43 |----------|----------|----------|----------|----------|----------------|