3.0.0 • Published 5 years ago

days-in-a-row v3.0.0

Weekly downloads
4,542
License
Unlicense
Repository
github
Last release
5 years ago

days-in-a-row

npm version Build Status

Return an array of dates (strings) based on a start date and a number.

Usage

const days = require('days-in-a-row');
const allTheDays = days(new Date('01/01/2017'), 45);
/* the result
[ '2017-01-01',
  '2017-01-02',
  ...
  '2017-02-13',
  '2017-02-14' ]
*/

// You can then map the results to javascript date object
const allTheDates = allTheDays((day) => new Date(day));
// Then something like daylight to format the day for display
var daylight = require('daylight');
const prettyDates = allTheDates.map((day) => daylight('l, F jS', day));
/*
[ 'Monday, Jan 1st',
  'Tuesday, Jan 2nd',
  ...
  'Monday, Feb 13th',
  'Tuesday, Feb 14th' ]
 */
3.0.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.1

7 years ago

1.0.0

9 years ago