Here’s the given input from the user:
Year = 2011, Month = 3 (March), Week = 2
I want to get the days in week 2 of March 2011 in JavaScript.
e.g. Sunday 6th, Monday 7th, Tuesday 8th, Wednesday 9th, Thursday 10th, Friday 11th, Saturday 12th
Any ideas? Thanks!
Given
and
then
dateNumbersOfMonthOnWeekwill have the date numbers of that week.datesOfMonthOnWeekwill have the date objects of that week.While this may seem like it is overkill for the job, much of this is required to make it work in all situations, like when the date numbers cross over to another month. I’m sure it could be optimised to be less verbose, though.