试图输出日期加上 30 天。我今天加载了脚本,当天显示“未定义”,脚本的其余部分都可以。'未定义,2013 年 4 月 7 日'。
这是我的脚本:
// handle the due date
var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday");
var monthNames = new Array("January","February","March","April","May","June","July", "August","September","October","November","December");
var todayPlus30 = new Date();
todayPlus30.setDate(todayPlus30.getDate()+30)
var dateStr = (dayNames[todayPlus30.getDate()] + ", " + monthNames[todayPlus30.getMonth()] + " " + todayPlus30.getDate() + ", " + todayPlus30.getFullYear());
$('#date').html(dateStr);