react-date-range icon indicating copy to clipboard operation
react-date-range copied to clipboard

Can I customize defaultStaticRanges to add more options

Open ImranArtwel opened this issue 3 years ago • 1 comments

Subject of the issue

I would like to add more static ranges like quarter, last quarter and next quarter to defaultStaticRanges

Environment

Package Version: React version: Node version: Browser:

ImranArtwel avatar Dec 10 '21 17:12 ImranArtwel

@imranArtwel define additional object below mention format const moreOption = [ { label: "last quarter", range: () => ({ startDate:addMonths(new Date(), -3), endDate: new Date() }) }, { label: "last quarter", range: () => ({ startDate:new Date(), endDate: addMonths(new Date(), 3) }) }, ]

const totalRages = [...defaultStaticRanges,...createStaticRanges(moreOption)]

<DateRangePicker staticRanges={totalRages} direction="vertical" rangeColors = {['#4d2400']} />)

  1. ``add months` function imported from date-fns package
  2. defaultStaticRanges imported from 'react-date-range' package

jayachandra572 avatar Dec 26 '21 12:12 jayachandra572