0

I need to find the Monday date for a given week and year.

Currently I have the following but for week 15 year 2020 it's giving me 4/8 and it should be 4/6.

function getDateOfWeek(weekNumber, year) {
            return new Date(year, 0, 1 + ((weekNumber - 1) * 7));
        }
user441521
  • 6,942
  • 23
  • 88
  • 160
  • What is your definition of "first week of the year"? E.g. : the week containing the first of january, or the first week of at least 4 days, or the first week containing a Monday? Which is the first day of the week? Monday, Sunday? – Alberto Chiesa Mar 24 '20 at 17:00
  • Monday should be the first day of the week. Week 15 should be 4/6/2020 which is a monday. That would mean 12/30/2019 was week 1 of 2020. – user441521 Mar 24 '20 at 17:11
  • _"To calculate the date of the start of a given ISO8601 week (which will always be a Monday)..."_ - It's all in the accepted answer. – Andreas Mar 24 '20 at 17:20

0 Answers0