Java date calculation

The PDF-XChange Viewer for End Users
+++ FREE +++

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

marksmanaz
User
Posts: 4
Joined: Wed Jul 07, 2010 6:51 pm

Java date calculation

Post by marksmanaz »

I have a fillable form I created with Acrobat pro with java script to calculate dates in the headers of columns I have setup. In acrobat and Acrobat reader the java calculates the dates correctly. In Xhange viewer if an input date is from the 2nd, 4th, 6th, 9th, or 11th month it jumps to the next month. The date format is "m/d" and is inputted into the field with the red line and all other headers are update from that date.

Example java code:

var strStart = this.getField("Date1").value;
if(strStart.length)
{
var myDate = util.scand("m,d",strStart);
var oneDay = 24 * 60 * 60 * 1000;
var dueMillis = myDate.getTime() + 13 * oneDay;
var dueDate = new Date(dueMillis);
event.value = util.printd("m/d",dueDate);
}
else
event.value = "";


Any reason Xchange does not process these months?

Thanks,

Mark
You do not have the required permissions to view the files attached to this post.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19930
Joined: Mon Jan 12, 2009 8:07 am

Re: Java date calculation

Post by Stefan - PDF-XChange »

Hello marksmanaz,

The months you have quoted are exactly the ones with less than 31 days in them, but the file you have provided is working correctly on my machine.

Could you please check which is the build of our Viewer you are using there?
The build number can be seen in Help -> About
And the latest current build is 2.0.55

Best,
Stefan
Arnold
User
Posts: 876
Joined: Tue Jun 09, 2009 3:53 am

Re: Java date calculation

Post by Arnold »

Stefan I tried it over here and I get the same results as marksmanaz. I am using version 2.0.56 with Windows XP sp3. When I set begin date to 6/15, the dates in the columns change to 7/15.

I have changed the short date format in Windows to 09/21/10. Don't know if that would affect it.
marksmanaz
User
Posts: 4
Joined: Wed Jul 07, 2010 6:51 pm

Re: Java date calculation

Post by marksmanaz »

Stefan,
I am using 2.54 and have just updated to 2.56 and still get the same result. My OS is Windows 7 64bit. I will test on XP machine when I have a chance.

Mark
marksmanaz
User
Posts: 4
Joined: Wed Jul 07, 2010 6:51 pm

Re: Java date calculation

Post by marksmanaz »

Stefan,
Do you think it may have to do with the regional settings on our computers? Are you in Canada? Arnold are you in the U.S.?

Mark
Arnold
User
Posts: 876
Joined: Tue Jun 09, 2009 3:53 am

Re: Java date calculation

Post by Arnold »

Yes I am in the US.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19930
Joined: Mon Jan 12, 2009 8:07 am

Re: Java date calculation

Post by Stefan - PDF-XChange »

Hi Mark and Arnold,

It is possible that it has something to do with the regional settings, as I am using XP as Arnold so it does not seem like a Win7 vs WinXP issue.

Will ask the dev guys to have a look at this.

Best,
Stefan
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19930
Joined: Mon Jan 12, 2009 8:07 am

Re: Java date calculation

Post by Stefan - PDF-XChange »

Hi Mark and Arnold,

The dev guys told me that they will investigate and try to fix this problem for version 2.5 of our Viewer.

Regards,
Stefan
marksmanaz
User
Posts: 4
Joined: Wed Jul 07, 2010 6:51 pm

Re: Java date calculation

Post by marksmanaz »

Thank you,
were they able to reproduce this behavior on their machines?

Mark
User avatar
John - Tracker Supp
Site Admin
Posts: 5225
Joined: Tue Jun 29, 2004 10:34 am

Re: Java date calculation

Post by John - Tracker Supp »

It would seem so ...
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com