Accessibility
Adobe
Sign in My orders My Adobe

Title

JavaScript Date objects passed through the Adobe AIR SandboxBridge lose their typeProducts affected

Issue

If you attempt to pass a JavaScript Date through the Adobe AIR SandboxBridge, it loses its type and appears only as Object.

Reason

Prototype methods of objects are generally not serialized across the interface; only the object's properties are sent.

Solution

Send the date as a number of milliseconds from a known base time.

The example code below demonstrates how you can serialize and deserialize the date so that its object type is maintained.

// Sending the number of milliseconds since 1 January 1970 00:00:00
myDate = new Date("January 1, 2008");
dateLong = myDate.getTime();

// ~~~ Bridge ~~~

mySameDate = new Date();
mySameDate.setTime(dateLong);

Doc ID
(kb403129)

Last updated
2009-11-18

OS
Windows Vista
Windows XP

Contacting Adobe Support

Still need help?
Find out about all your support options.
Contact support