]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/Date/15.9.4.2-1.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / mozilla / ecma / Date / 15.9.4.2-1.js
1 /*
2 * The contents of this file are subject to the Netscape Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/NPL/
6 *
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
11 *
12 * The Original Code is mozilla.org code.
13 *
14 * The Initial Developer of the Original Code is Netscape
15 * Communications Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
17 * Rights Reserved.
18 *
19 * Contributor(s):
20 */
21
22 /**
23 * File Name:
24 * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=4088
25 * Description: Date parsing gets 12:30 AM wrong.
26 * New behavior:
27 * js> d = new Date('1/1/1999 13:30 AM')
28 * Invalid Date
29 * js> d = new Date('1/1/1999 13:30 PM')
30 * Invalid Date
31 * js> d = new Date('1/1/1999 12:30 AM')
32 * Fri Jan 01 00:30:00 GMT-0800 (PST) 1999
33 * js> d = new Date('1/1/1999 12:30 PM')
34 * Fri Jan 01 12:30:00 GMT-0800 (PST) 1999
35 * Author: christine@netscape.com
36 */
37
38 var SECTION = "15.9.4.2-1"; // provide a document reference (ie, ECMA section)
39 var VERSION = "ECMA"; // Version of JavaScript or ECMA
40 var TITLE = "Regression Test for Date.parse"; // Provide ECMA section title or a description
41 var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=4088"; // Provide URL to bugsplat or bugzilla report
42
43 startTest(); // leave this alone
44
45 AddTestCase( "new Date('1/1/1999 12:30 AM').toString()",
46 new Date(1999,0,1,0,30).toString(),
47 new Date('1/1/1999 12:30 AM').toString() );
48
49 AddTestCase( "new Date('1/1/1999 12:30 PM').toString()",
50 new Date( 1999,0,1,12,30 ).toString(),
51 new Date('1/1/1999 12:30 PM').toString() );
52
53 AddTestCase( "new Date('1/1/1999 13:30 AM')",
54 "Invalid Date",
55 new Date('1/1/1999 13:30 AM').toString() );
56
57
58 AddTestCase( "new Date('1/1/1999 13:30 PM')",
59 "Invalid Date",
60 new Date('1/1/1999 13:30 PM').toString() );
61
62 test(); // leave this alone. this executes the test cases and
63 // displays results.