michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /** michael@0: * File Name: michael@0: * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=4088 michael@0: * Description: Date parsing gets 12:30 AM wrong. michael@0: * New behavior: michael@0: * js> d = new Date('1/1/1999 13:30 AM') michael@0: * Invalid Date michael@0: * js> d = new Date('1/1/1999 13:30 PM') michael@0: * Invalid Date michael@0: * js> d = new Date('1/1/1999 12:30 AM') michael@0: * Fri Jan 01 00:30:00 GMT-0800 (PST) 1999 michael@0: * js> d = new Date('1/1/1999 12:30 PM') michael@0: * Fri Jan 01 12:30:00 GMT-0800 (PST) 1999 michael@0: * Author: christine@netscape.com michael@0: */ michael@0: michael@0: var SECTION = "15.9.4.2-1"; // provide a document reference (ie, ECMA section) michael@0: var VERSION = "ECMA"; // Version of JavaScript or ECMA michael@0: var TITLE = "Regression Test for Date.parse"; // Provide ECMA section title or a description michael@0: var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=4088"; // Provide URL to bugsplat or bugzilla report michael@0: michael@0: startTest(); // leave this alone michael@0: michael@0: AddTestCase( "new Date('1/1/1999 12:30 AM').toString()", michael@0: new Date(1999,0,1,0,30).toString(), michael@0: new Date('1/1/1999 12:30 AM').toString() ); michael@0: michael@0: AddTestCase( "new Date('1/1/1999 12:30 PM').toString()", michael@0: new Date( 1999,0,1,12,30 ).toString(), michael@0: new Date('1/1/1999 12:30 PM').toString() ); michael@0: michael@0: AddTestCase( "new Date('1/1/1999 13:30 AM')", michael@0: "Invalid Date", michael@0: new Date('1/1/1999 13:30 AM').toString() ); michael@0: michael@0: michael@0: AddTestCase( "new Date('1/1/1999 13:30 PM')", michael@0: "Invalid Date", michael@0: new Date('1/1/1999 13:30 PM').toString() ); michael@0: michael@0: test(); // leave this alone. this executes the test cases and michael@0: // displays results.