I got a weeknumber from a jquery datepicker, when a user selects a date. But now I want to get all the days within that week.
I could add a click event that loops through all the td’s of the tr the selected date is in and graps it’s value but I’m looking for a more reliable way.
So my question is, given a certain date and a weeknumber (iso 8601 formatted), how can you derive the other dates within that week with javascript?
You can solve it by subtracting the selected date day (getDate()), with the day of the week (getDay()). This way you have the first day of the week. Then you can use a for loop till 7, to get all the other days. You don’t need the weeknumber.