JSFiddle - React, Tailwind, and code Playground
JavaScript
var MONTHS = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],
targetDays = [5, 10],
i, j,
targetDate,
curTargetDay,
curDay,
finalMonth,
finalDate;
for (i = 0, j = targetDays.length; i < j; i++) {
targetDate = new Date();
curTargetDay = targetDays[i];
while (curTargetDay) {
targetDate.setDate(targetDate.getDate() + 1);
curDay = targetDate.getDay();
if (curDay !== 0 && curDay !== 6) {
curTargetDay--;
}
}
console.log(targetDate.getDate(), MONTHS[targetDate.getMonth()]);
}