Here's the output from the Visual Studio Immediate Window. I start with mondaysDate
, create a second date, thisDate
, and then add integers to it using mondaysDate as the base.
I don't understand why adding 3 to the date yields November 2 and adding 4 to the date yields December 4th.
Is it illegal to invoke setDate() more than once?
?mondaysDate
Mon Oct 30 2017 00:00:00 GMT-0400 (Eastern Daylight Time)
?thisDate
Mon Oct 30 2017 00:00:00 GMT-0400 (Eastern Daylight Time)
?thisDate.setDate(mondaysDate.getDate() + 3)
1509595200000
?thisDate
Thu Nov 02 2017 00:00:00 GMT-0400 (Eastern Daylight Time)
?thisDate.setDate(mondaysDate.getDate() + 4)
1512363600000
?thisDate
Mon Dec 04 2017 00:00:00 GMT-0500 (Eastern Standard Time)
?mondaysDate
Mon Oct 30 2017 00:00:00 GMT-0400 (Eastern Daylight Time)