You could divide the hours by the week length and use Math.ceil
for rounding.
function getWeeks(hours) {
return Math.ceil(hours / 24 / 7);
}
console.log(getWeeks(196)); // two weeks
console.log(getWeeks(169)); // two weeks
console.log(getWeeks(168)); // one week
solved Finding week period based on number of days. [closed]