Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Decrement or Increment month #20

Open
soongsta opened this issue Feb 7, 2017 · 1 comment
Open

Decrement or Increment month #20

soongsta opened this issue Feb 7, 2017 · 1 comment

Comments

@soongsta
Copy link

soongsta commented Feb 7, 2017

Hi There

I am wondering if its possible to do something like this in ranges

function cb(start, end) {
    $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
}

$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'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')],
'Decrement Month': [moment(start).subtract(1, 'month').startOf('month'), moment(end).subtract(1, 'month').endOf('month')]
}
}, cb);

var start = moment().startOf('month');
var end = moment().endOf('month');
cb(start, end);

@soongsta
Copy link
Author

soongsta commented Feb 7, 2017

Basically, keep on decrementing or incrementing the current displayed month

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant