These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

scand issue in Acrobat 9: returns 00:00:00 instead of actual time

eporlier
Registered: Jan 28 2010
Posts: 6

Hi,

We have hundreds of forms using javascript to, amongst other, populate calendar date fields...

The user fills a field ('scrutin' = date 0) which is validated... If it is a real date, AND A SUNDAY, then we populate the other days of the month.

It works very fine in all Reader/Acrobat version from 5.05 through 8.x. And it's been working fine for years!

I don't know why, but the time zone changes 'one day or the other' : for instance, if the user enters 20100328 (yyyymmdd = March 28, 2010) then, on march 14th, the time zone changes from GMT-0400 to GMT-0500 (We are in Québec, Canada). It is OK in previous versions, since util.scand() returns the exact moment of the event: so if it is 2 p.m., and the time zone changes, we get to 1 p.m. the same day, and we're OK.

In version 9, however, valueOf() returns the day, at 00:00:00, so midnight. Then, I think the rest is quite obvious: When we read the date in the field ('scrutin' = date 0), we use 'valueOf' to get the time in milliseconds since jan. 1, 1970. The time is then converted to a date with util.printd(). We now have a date with 00:00:00 (so midnight) as time of day. When the time zone changes, we are brought back to the day before, at 11:00 p.m.!

You can check it at: (Sorry, the messages in the form are in French! Remember to enter a SUNDAY... )
http://www.electionsquebec.qc.ca/calbugforum/DGE-1003.1_bug.pdf

Has the core javascript changed? I don't think so... So, any idea what has changed in version 9.

And the real question is : Is it a bug that will be fixed, or do I have to go through all our forms to modify every 'date calculating' function???

Thanks
Eric

My Product Information:
Acrobat Pro 8.1.3, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Adboe is always tightening the checking of Acrobat JavaScirpt language, and they are not going to losen up the checking.

Instead of assuming a non-blank value for the'scrutin' filed is 'true' enter statement that will resolve to a true of false value.
console.show();console.clear();console.println('value: |' + event.value + '|');console.println('typeof: ' + (typeof event.value) );console.println('value.toString(): ' + event.value.toString());console.println('value.toString().length: ' + event.value.toString().length);console.println((event.value | event.value) != 0);if(event.value){console.println('affDateComplete');event.value = affDateComplete(event.value);}

George Kaiser

eporlier
Registered: Jan 28 2010
Posts: 6
Thanks gkaiseril, but I think I might have expressed myself badly...

In fact, I'm not assuming, I am validating the field value, and it works fine.

When the function is called, we have a valid value. That is OK. When I wrote

Quote:
'scrutin' = date 0
I meant that the field 'scrutin' is [b]Day[/b] 0, the day from where we start calculation...
My problem is really with 'util.scand' which won't return the same thing in Acrobat 8 and in Acrobat 9, given the same arguments.
[img]http://electionsquebec.qc.ca/calbugforum/acrobat8.jpg[/img][img]http://electionsquebec.qc.ca/calbugforum/acrobat9.jpg[/img]
In Acrobat 8:You can see that 'Converted to date' which is the result of util.scand = 'Sun Mar 28 2010 [b]20:22:22[/b] GMT-0400
While in Acrobat 9: We get 'Converted to date' which is the result of util.scand = 'Sun Mar 28 2010 [b]00:00:00[/b] GMT-0400

I must confess that even the GMT going from -0400 to -0500 (not shown here, but it happens while I'm going through the 'for' to fill in all the days of the month!) was not expected, but I can cope with that since it would need the user to complete the form between midnight and 1:00 a.m. to impact the result... (The form is for office purposes, so it won't happen to often!), but my real problem is the time being 00:00:00! When the GMT changes during calculation (Again, I don't know why...), at one point, this will result in (with Acrobat 9):
'[b][color=#FF0000]Sat Mar 13[/color] 2010 [color=#FF0000]23[/color]:00:00 GMT-0500[/b]' where it is expected to be
'[b]Sun Mar 14 2010 00:00:00 GMT-0400[/b]'

With Acrobat 8, I get something like
'[b]Sun Mar 14 2010 15:40:00 GMT-0500[/b]' where it is expected to be
'[b]Sun Mar 14 2010 16:40:00 GMT-0400[/b]', but it is not an issue, since I format the date with util.printd... as 'March 14'.

I know how to fix the problem if I need to (if Acrobat behaves like this further on), but I was hoping that that was a bug... or something that could be fixed without me changing all the forms we have...

Thanks again
Eric
eporlier
Registered: Jan 28 2010
Posts: 6
Problem has been logged into Acrobat bug system (#2551619).
They are working on it.
Thanks

Eric