I would greatly appreciate an explanation of why the following results in changes to all the date variables at the top of the following code. I’ve tried many ways of finding out what is occurring, but I am stumped.
Thanks in advance!!!
set myDate to (current date)
set testDate to myDate
set testDate to my addMonths(testDate, 2)
set showDate to date string of myDate
on addMonths(modDate, theMonths)
set totalMonths to ((month of modDate) + theMonths)
if totalMonths > 12 then
set excessMonths to totalMonths - (totalMonths div 12)
set modDate's year to (totalMonths div 12)
set modDate's month to excessMonths
else
set modDate's month to totalMonths
end if
return modDate
end addMonths
Browser: Firefox 50.0
Operating System: Mac OS X (10.10)