You could take a bitwise AND &
with the day value and take this day.
const
days = { Monday: 1, Tuesday: 2, Wednesday: 4, Thursday: 8, Friday: 16, Saturday: 32, Sunday: 64 },
getDays = value => Object.keys(days).filter(day => value & days[day]);
console.log(getDays(127)); // All Days
console.log(getDays(80)); // Friday, Sunday
console.log(getDays(7)); // Monday, Tuesday, Wednesday
.as-console-wrapper { max-height: 100% !important; top: 0; }
1
solved Formula to find week numbers from the Total [closed]