Not sure about using moment.js, but in plain js next Thursday is given by:
currentDate + (11 - d.getDay() % 7)
For the following Thursday, just add 7 days. Presumably if the current day is Thursday, want the Thursday in two weeks so:
var d = new Date();
console.log(d.toString());
// Shift to next Thursday
d.setDate(d.getDate() + ((11 - d.getDay()) % 7 || 7) + 7)
console.log(d.toString())
Or encapsulated in a function with some tests:
function nextThursdayWeek(d) {
d = d || new Date();
d.setDate(d.getDate() + ((11 - d.getDay()) % 7 || 7) + 7);
return d;
}
// Test data
[new Date(2017,2,6), // Mon 6 Mar 2017
new Date(2017,2,7), // Tue 7 Mar 2017
new Date(2017,2,8), // Wed 8 Mar 2017
new Date(2017,2,9), // Thu 9 Mar 2017
new Date(2017,2,10), // Fri 10 Mar 2017
new Date(2017,2,11), // Sat 11 Mar 2017
new Date(2017,2,12), // Sun 12 Mar 2017
new Date() // Today
].forEach(function (date) {
console.log(date.toString() + ' -> ' + nextThursdayWeek(date).toString());
});