JSPM

days-in-a-row

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2318
  • Score
    100M100P100Q117915F
  • License Unlicense

Return an array of days

Package Exports

  • days-in-a-row

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (days-in-a-row) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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' ]
 */