1.0.0 • Published 5 years ago

get-date-range v1.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

Input an array of date objects to return the range of those dates as a human readable string.

Installation/usage

Using npm:

$ npm i get-date-range

Load ES module:

import GetDateRange from `get-date-range`;

Example

const myDates1 = [new Date("2018/12/1"), new Date("2019/3/1"), ...]
const myDates2 = [new Date("2019/1/1"), new Date("2019/3/1"), ...]
const myDates3 = [new Date("2019/3/1"), new Date("2019/3/5"), ...]

GetDateRange(myDates1)
// output: "Dec 1, 2018 - Mar 1, 2019"

GetDateRange(myDates2)
// output: "Jan 1 - Mar 1, 2019"

GetDateRange(myDates3)
// output: "Mar 1-5, 2019"