如何添加6天到当前日期?

时间:2019-01-16 06:47:31

标签: javascript html

这是我的js。现在,当日期为2月28日时,第7天将为35。 如何修复我的js代码? 我想显示从现在到第7天的确切日期。

userInfoUri
//Get Upcoming Bookings Current Date
getUpcomingBookingsCurrenDate = () => {
  let currentDate = Date.now();
  let day = new Date(currentDate).getDate();
  let day2 = day + 1;
  let day3 = day + 2;
  let day4 = day + 3;
  let day5 = day + 4;
  let day6 = day + 5;
  let day7 = day + 6;
  document.getElementById('day1').innerHTML = day;
  document.getElementById('day2').innerHTML = day2;
  document.getElementById('day3').innerHTML = day3;
  document.getElementById('day4').innerHTML = day4;
  document.getElementById('day5').innerHTML = day5;
  document.getElementById('day6').innerHTML = day6;
  document.getElementById('day7').innerHTML = day7;
}
getUpcomingBookingsCurrenDate();

0 个答案:

没有答案