日付と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);