longbill/jquery-date-range-picker

Shortcut for "This week" "This month"

Closed this issue · 2 comments

Hi!

Like this shortcuts This week or This month would be great.
or
How to make this with customShortcuts section?

Ok, I find a solution:
{
name: '| This Week ',
dates : function()
{
var start = moment().day(1).toDate();
var end = moment().day(7).toDate();
return [start,end];
}
},
{
name: '| This Month ',
dates : function()
{
var start = moment().startOf('month').toDate();
var end = moment().endOf('month').toDate();
return [start,end];
}
},

You can also see more examples for the custom shortcuts here. I will close this issue as it is resolved, feel free to reply to this thread if you have further questions regarding the usage of shortcuts.