このソリューションには追加のライブラリを追加する必要がありますが、それだけの価値があると思います。これは、日付と時刻を操作するためのmomentjsライブラリです。積極的にメンテナンスされており、優れたドキュメントがあります。day と weekNumber の値 (この場合は 3 と 43) を取得したら、次のようにします。
function formatInput(day, weekNumber){
var currentDate = moment(new Date()); // initialize moment to a current date
currentDate.startOf('year'); // set to Jan 1 12:00:00.000 pm this year
currentDate.add('w',weekNumber - 1); // add number of weeks to the beginning of the year (-1 because we are now at the 1st week)
currentDate.day(day); // set the day to the specified day, Monday being 1, Sunday 7
alert(currentDate.format("dddd, MMMM Do YYYY")); // return the formatted date string
return currentDate.format("dddd, MMMM Do YYYY");
}
このライブラリは後で役立つ可能性があり、日付と時刻の操作や書式設定オプションに関して多くの可能性があると思います。momentjs について書かれた優れたドキュメントもあります。