スクリプトで次のものを使用しています。
var startDate = new Date("10/12/2012");
var endDate = new Date("10/18/2012");
これらの日付を、startDateを先週の月曜日、endDateを先週の日曜日として動的に作成したいと思います。私は以下を試しました:
var curr = new Date; // get current date
var first = curr.getDate() - curr.getDay(); // First day is the day of the month - the day of the week
var last = first + 6; // last day is the first day + 6
var startDate = new Date(curr.setDate(first)).format("m/dd/yyyy");
var endDate = new Date(curr.setDate(last)).format("m/dd/yyyy");
しかし、何らかの理由でこれは機能しません。startDate変数またはendDate変数には何も出力されません。
私が間違っていることについて何か考えはありますか?