daterange
A library for generating date ranges as a simple wrapper around date-fns
Installation
npm i -S @devtanc/daterange
yarn add @devtanc/daterange
Usage
Calendar Ranges
This function is for generating ranges that conform to calendar units like days, weeks, months, quarters, or years. The return object is in the form of:
{
start: Date,
end: Date
}
import { getCalendarRange } from '@devtanc/daterange'
getCalendarRange('day')
getCalendarRange('day', 2)
getCalendarRange('month', 0, new Date(2017, 2, 12))
getCalendarRange('month', 1, new Date(2017, 2, 12))