Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=7223
[WebKit-https.git] / LayoutTests / fast / AppleScript / date.html
1 <html>
2 <head>
3 <title>do JavaScript - converting to AppleScript date type</title>
4 </head>
5 <body>
6 <script type="text/javascript">
7
8     var console_messages = document.createElement("ol");
9     
10     function log(message)
11     {
12         var item = document.createElement("li");
13         item.appendChild(document.createTextNode(message));
14         console_messages.appendChild(item);
15     }
16     if (window.layoutTestController) {
17         
18         try {
19         
20             layoutTestController.dumpAsText();
21
22             // 0xc00d6be5 == Mon Feb 06 2006 21:11:01
23             log(appleScriptController.doJavaScript("new Date(2006,1,6,21,11,1)"));
24
25             // 0x7c4e8f00 == Sun Feb 01 1970 00:00:00
26             log(appleScriptController.doJavaScript("new Date(1970,1,1)"));
27              
28             // 0x7c25dab0 == Thu Jan 01 1970 03:00:00
29             log(appleScriptController.doJavaScript("new Date(1970,0,1,3)"));
30
31             // 0x1383ec400 == Wed Jan 01 2070 00:00:00
32             log(appleScriptController.doJavaScript("new Date(2070,0,1)"));
33             
34             // 0x56871300 == Sun Jan 01 1950 00:00:00
35             log(appleScriptController.doJavaScript("new Date(1950,0,1)"));
36             
37             // 0x00000000 == Fri Jan 01 1904 00:00:00
38             log(appleScriptController.doJavaScript("new Date(1904,0,1)"));
39             
40             // 0xffffffff3c637000 == Wed Jan 01 1800 00:00:00
41             log(appleScriptController.doJavaScript("new Date(1800,0,1)"));
42
43             // invalid date 
44             log(appleScriptController.doJavaScript("new Date(1e40)"));
45
46         } catch (ex) {
47             log("Exception: " + ex.description);
48         }
49
50         var console = document.createElement("p");
51         console.appendChild(console_messages);
52         document.body.appendChild(console);
53         
54     } else {
55         document.write("(cannot run interactively)");
56     }
57 </script>
58 </body>
59 </html>