Returns the last day of the week that contains the CalculationDate.

var date = now.valueOf('2017-03-15'); 

var endOfWeek = date.endOfWeek();

console.log('Day of the month = %s', endOfWeek);

//endOfWeek = 2017-03-19 00:00:00
Did this answer your question?