I searched for this question and found there is a no answer on Stackoverflow.. So I decided to answer it...
This question helps if you need to get the start/end of n
This is specified in the lang file, you can include the lang/en-au.js or lang/en-gb.js file and set the desired language standard. Assume you're in the UK:
moment.lang('en-gb');
If you don't want to use a custom language, you can change it for the default US locale:
moment.lang('en-custom', {
week: {
dow: 1,
doy: 6 // Adjust the first week of the year, depends on the country. For the US it's 6. For the UK, 4.
}
});
Then you can do:
var date = '2014-03-24';
console.log('next start', moment(date).weekday(7).format('DD/MM/YYYY'));
console.log('next end', moment(date).weekday(13).format('DD/MM/YYYY'));
console.log('prev start', moment(date).weekday(-7).format('DD/MM/YYYY'));
console.log('prev end', moment(date).weekday(-1).format('DD/MM/YYYY'));
console.log('current start', moment(date).weekday(0).format('DD/MM/YYYY'));
console.log('current end', moment(date).weekday(6).format('DD/MM/YYYY'));
/*
next start 31/03/2014
next end 06/04/2014
prev start 17/03/2014
prev end 23/03/2014
current start 24/03/2014
current end 30/03/2014
*/
http://jsfiddle.net/WGXxn/3/