I have a form where you enter the pay beginning date and that populates the working days and weekends in the pay period. The form used to calculate correctly but now the dates for NOVEMBER and only NOVEMBER will not work. If I enter 11/01/2009, the first two days calculate as 11/1 and it will only display until the 14. If I do the same for any other month then it calculates correctly...
var strStart = this.getField("EmpInfo.startDate").value; gets the date entered
if(strStart.length)
{
var dateStart = util.scand("mm/dd/yyyy",strStart);
var oneDay = 24 * 60 * 60 * 1000;
var dueMillis = dateStart.getTime(); to calculate following dates I use dateStart.getTime() + 1 * oneDay substituting the 1 for the number of days Im trying to add.
var dueDate = new Date(dueMillis);
event.value = util.printd("m/d/yy",dueDate);
}
any help will be appreciated.. Im willing to share the form in exchange for some help. This used to work. I have last year's November form saved and the dates look right now when I reset the form and enter the same date (11/01/2008) it repeats 11/2!!!
Have you added any "console.println()" statements to this code to see what the intermediate values are?
You could also try adding an hour to the date value so that rounding errors won't cause it to cross an unwanted boundary.
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script