Debian Codegraph @

rhino/testsrc/tests/ecma/Date/15.9.4.2-1.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 gTestfile = '15.9.4.2-1.js';
7
8 /**
9 * File Name:
10 * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=4088
11 * Description: Date parsing gets 12:30 AM wrong.
12 * New behavior:
13 * js> d = new Date('1/1/1999 13:30 AM')
14 * Invalid Date
15 * js> d = new Date('1/1/1999 13:30 PM')
16 * Invalid Date
17 * js> d = new Date('1/1/1999 12:30 AM')
18 * Fri Jan 01 00:30:00 GMT-0800 (PST) 1999
19 * js> d = new Date('1/1/1999 12:30 PM')
20 * Fri Jan 01 12:30:00 GMT-0800 (PST) 1999
21 * Author: [email protected]
22 */
23
24 var SECTION = "15.9.4.2-1"; // provide a document reference (ie, ECMA section)
25 var VERSION = "ECMA"; // Version of JavaScript or ECMA
26 var TITLE = "Regression Test for Date.parse"; // Provide ECMA section title or a description
27 var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=4088"; // Provide URL to bugsplat or bugzilla report
28
29 startTest(); // leave this alone
30
31 AddTestCase( "new Date('1/1/1999 12:30 AM').toString()",
32 new Date(1999,0,1,0,30).toString(),
33 new Date('1/1/1999 12:30 AM').toString() );
34
35 AddTestCase( "new Date('1/1/1999 12:30 PM').toString()",
36 new Date( 1999,0,1,12,30 ).toString(),
37 new Date('1/1/1999 12:30 PM').toString() );
38
39 AddTestCase( "new Date('1/1/1999 13:30 AM')",
40 "Invalid Date",
41 new Date('1/1/1999 13:30 AM').toString() );
42
43
44 AddTestCase( "new Date('1/1/1999 13:30 PM')",
45 "Invalid Date",
46 new Date('1/1/1999 13:30 PM').toString() );
47
48 test(); // leave this alone. this executes the test cases and
49 // displays results.