'When you know what week it is, how to find out the start date of the week

Through the 'date-fns' module, I am receiving numbers of how many weeks the date is this year.

const current = '2022-03-10'
const weekNumber = getWeek(current, 1) // 11

On the contrary, if you only know the numbers, you want to know how to do the first date of the week number.

The way I want to know.

const weekNumber = 11;
const weekOfstartDate = anyFunc(weekNumber) // '2022-03-07'

Do you know the answer to this solution?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source