I have text fields created on a form in Acrobat Pro 6. The forms are supposed to take the Friday "week ending date" and subtract one day for each preceding day of the week. the problem is that when the ending day is friday the 1st, the preceeding days go into negative numbers. What I would like to do is use if/then statemens so that if Friday = 1, then thursday will = 30, but if friday = 10 then Thursday will = 9. Do you have resources for learning this scripting for Acrobat.
Feb is that lovely special case, and so if Friday, March 1 is in order, to find Thursday, you first need to determine if it was a leap-year or not (check wikipedia on leap year formula - modulus 400 should be sufficient for most work). Once you know that, you know whether Feb had 28 or 29 days. Plug that into the array then continue on as before.
Another method, if leap year calcs get confusing, is just to have another array with the leap years. Cell #1 needs to be some known year (Note it in the comments!!!) - then each successive cell is a binary value True (leap year) False (not a leap year). You perform the lookup as a subtractive offset. CurYear - BaseYear = array offset. Simple if/then to populate your Month array with the correct value and continue on your merry way.
There shouldn't be any limitations in JS to perform this (the most complicated thing is the Modulus operator), it's just that functions like this generally don't exist in most languages - so you build your own, but don't reinvent the wheel.
A couple of Google searches will come up with a wealth of logic dealing with this issue.
Good luck!
Douglas Hanna is a member of the Production Print Technology team at Aon.
www.aonhewitt.com