Rajesh
Rajesh

Reputation: 399

Need exactly one month in custom of daterangepicker

I've specified the datelimit as dateLimit: { months : 1 } in daterangepicker configuration. When we click custom range and select dates, it is selecting 1 date plus one month.

Let's say if i open the datepicker now then it shows me the range until 05/08/2016. But i want to see 04/08/2016.

I want it to select exact one month. I've searched docs in http://www.daterangepicker.com/ but I'm not able to find the solution.

Upvotes: 0

Views: 1950

Answers (1)

Therichpost
Therichpost

Reputation: 1815

Here you can check:

    $('#reportrange').daterangepicker({
    startDate: start,
    endDate: end,
    ranges: {
       'Last 7 Days': [moment().subtract(6, 'days'), moment()],
       'Last 30 Days': [moment().subtract(29, 'days'), moment()],
       'This Month': [moment().startOf('month'), moment().endOf('month')],
       'Last Month': [moment().subtract(1, 'month').startOf('month'), 
     moment().subtract(1, 'month').endOf('month')]
    },
    "dateLimit": {
            "month": 1
        },
 }, cb);

Upvotes: 1

Related Questions