1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma/Date/15.9.4.2-1.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,48 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 + 1.10 +/** 1.11 + * File Name: 1.12 + * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=4088 1.13 + * Description: Date parsing gets 12:30 AM wrong. 1.14 + * New behavior: 1.15 + * js> d = new Date('1/1/1999 13:30 AM') 1.16 + * Invalid Date 1.17 + * js> d = new Date('1/1/1999 13:30 PM') 1.18 + * Invalid Date 1.19 + * js> d = new Date('1/1/1999 12:30 AM') 1.20 + * Fri Jan 01 00:30:00 GMT-0800 (PST) 1999 1.21 + * js> d = new Date('1/1/1999 12:30 PM') 1.22 + * Fri Jan 01 12:30:00 GMT-0800 (PST) 1999 1.23 + * Author: christine@netscape.com 1.24 + */ 1.25 + 1.26 +var SECTION = "15.9.4.2-1"; // provide a document reference (ie, ECMA section) 1.27 +var VERSION = "ECMA"; // Version of JavaScript or ECMA 1.28 +var TITLE = "Regression Test for Date.parse"; // Provide ECMA section title or a description 1.29 +var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=4088"; // Provide URL to bugsplat or bugzilla report 1.30 + 1.31 +startTest(); // leave this alone 1.32 + 1.33 +AddTestCase( "new Date('1/1/1999 12:30 AM').toString()", 1.34 + new Date(1999,0,1,0,30).toString(), 1.35 + new Date('1/1/1999 12:30 AM').toString() ); 1.36 + 1.37 +AddTestCase( "new Date('1/1/1999 12:30 PM').toString()", 1.38 + new Date( 1999,0,1,12,30 ).toString(), 1.39 + new Date('1/1/1999 12:30 PM').toString() ); 1.40 + 1.41 +AddTestCase( "new Date('1/1/1999 13:30 AM')", 1.42 + "Invalid Date", 1.43 + new Date('1/1/1999 13:30 AM').toString() ); 1.44 + 1.45 + 1.46 +AddTestCase( "new Date('1/1/1999 13:30 PM')", 1.47 + "Invalid Date", 1.48 + new Date('1/1/1999 13:30 PM').toString() ); 1.49 + 1.50 +test(); // leave this alone. this executes the test cases and 1.51 +// displays results.