For a datepicker I need two dates: from: today - 7 days, to: today + 7 days.
I get a currentDate with:
  var toDay = new Date();
  var curr_date = toDay.getDate();
  var curr_month = toDay.getMonth();
  curr_month++;
  var curr_year = toDay.getFullYear();
  var toDay = (curr_month + "/" + curr_date + "/" + curr_year);
How to get 7 days+ and 7 days- dates ? With corresponding month!
As per comment, You can use following code
var myDate = new Date();
myDate.setDate(myDate.getDate() + 7);
var nextWeekDate = ((myDate.getMonth() + 1) + "/" + myDate.getDate() + "/" + myDate.getFullYear());
myDate = new Date();
myDate.setDate(myDate.getDate() -7 );
var prevWeekDate = ((myDate.getMonth() + 1) + "/" + myDate.getDate() + "/" + myDate.getFullYear());
Modified Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With