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/. */
9
ECMA Section: 15.9.2.1 Date constructor used as a function
10
Date( year, month, date, hours, minutes, seconds, ms )
11
Description: The arguments are accepted, but are completely ignored.
12
A string is created and returned as if by the
13
expression (new Date()).toString().
15
Author: christine@netscape.com
19
var VERSION = "ECMA_1";
21
var SECTION = "15.9.2.1";
22
var TITLE = "Date Constructor used as a function";
23
var TYPEOF = "string";
26
writeHeaderToLog("15.9.2.1 The Date Constructor Called as a Function: " +
27
"Date( year, month, date, hours, minutes, seconds, ms )" );
29
// allow up to 1 second difference due to possibility
30
// the date may change by 1 second in between calls to Date
38
d2 = Date.parse(Date(1970,0,1,0,0,0,0));
39
new TestCase(SECTION, "Date(1970,0,1,0,0,0,0)", true, d2 - d1 <= 1000);
42
d2 = Date.parse(Date(1969,11,31,15,59,59,999));
43
new TestCase(SECTION, "Date(1969,11,31,15,59,59,999)", true, d2 - d1 <= 1000);
46
d2 = Date.parse(Date(1969,11,31,16,0,0,0));
47
new TestCase(SECTION, "Date(1969,11,31,16,0,0,0)", true, d2 - d1 <= 1000);
50
d2 = Date.parse(Date(1969,11,31,16,0,0,1));
51
new TestCase(SECTION, "Date(1969,11,31,16,0,0,1)", true, d2 - d1 <= 1000);
55
d2 = Date.parse(Date(1999,11,15,59,59,999));
56
new TestCase(SECTION, "Date(1999,11,15,59,59,999)", true, d2 - d1 <= 1000);
59
d2 = Date.parse(Date(1999,11,16,0,0,0,0));
60
new TestCase(SECTION, "Date(1999,11,16,0,0,0,0)", true, d2 - d1 <= 1000);
63
d2 = Date.parse(Date(1999,11,31,23,59,59,999));
64
new TestCase(SECTION, "Date(1999,11,31,23,59,59,999)", true, d2 - d1 <= 1000);
67
d2 = Date.parse(Date(2000,0,0,0,0,0,0));
68
new TestCase(SECTION, "Date(2000,0,1,0,0,0,0)", true, d2 - d1 <= 1000);
71
d2 = Date.parse(Date(2000,0,0,0,0,0,1));
72
new TestCase(SECTION, "Date(2000,0,1,0,0,0,1)", true, d2 - d1 <= 1000);
77
d2 = Date.parse(Date(1899,11,31,23,59,59,999));
78
new TestCase(SECTION, "Date(1899,11,31,23,59,59,999)", true, d2 - d1 <= 1000);
81
d2 = Date.parse(Date(1900,0,1,0,0,0,0));
82
new TestCase(SECTION, "Date(1900,0,1,0,0,0,0)", true, d2 - d1 <= 1000);
85
d2 = Date.parse(Date(1900,0,1,0,0,0,1));
86
new TestCase(SECTION, "Date(1900,0,1,0,0,0,1)", true, d2 - d1 <= 1000);
89
d2 = Date.parse(Date(1899,11,31,16,0,0,0,0));
90
new TestCase(SECTION, "Date(1899,11,31,16,0,0,0,0)", true, d2 - d1 <= 1000);
92
// Dates around feb 29, 2000
95
d2 = Date.parse(Date(2000,1,29,0,0,0,0));
96
new TestCase(SECTION, "Date(2000,1,29,0,0,0,0)", true, d2 - d1 <= 1000);
99
d2 = Date.parse(Date(2000,1,28,23,59,59,999));
100
new TestCase(SECTION, "Date(2000,1,28,23,59,59,999)", true, d2 - d1 <= 1000);
103
d2 = Date.parse(Date(2000,1,27,16,0,0,0));
104
new TestCase(SECTION, "Date(2000,1,27,16,0,0,0)", true, d2 - d1 <= 1000);
106
// Dates around jan 1, 2005
108
d2 = Date.parse(Date(2004,11,31,23,59,59,999));
109
new TestCase(SECTION, "Date(2004,11,31,23,59,59,999)", true, d2 - d1 <= 1000);
112
d2 = Date.parse(Date(2005,0,1,0,0,0,0));
113
new TestCase(SECTION, "Date(2005,0,1,0,0,0,0)", true, d2 - d1 <= 1000);
116
d2 = Date.parse(Date(2005,0,1,0,0,0,1));
117
new TestCase(SECTION, "Date(2005,0,1,0,0,0,1)", true, d2 - d1 <= 1000);
120
d2 = Date.parse(Date(2004,11,31,16,0,0,0,0));
121
new TestCase(SECTION, "Date(2004,11,31,16,0,0,0,0)", true, d2 - d1 <= 1000);
123
// Dates around jan 1, 2032
125
d2 = Date.parse(Date(2031,11,31,23,59,59,999));
126
new TestCase(SECTION, "Date(2031,11,31,23,59,59,999)", true, d2 - d1 <= 1000);
129
d2 = Date.parse(Date(2032,0,1,0,0,0,0));
130
new TestCase(SECTION, "Date(2032,0,1,0,0,0,0)", true, d2 - d1 <= 1000);
133
d2 = Date.parse(Date(2032,0,1,0,0,0,1));
134
new TestCase(SECTION, "Date(2032,0,1,0,0,0,1)", true, d2 - d1 <= 1000);
137
d2 = Date.parse(Date(2031,11,31,16,0,0,0,0));
138
new TestCase(SECTION, "Date(2031,11,31,16,0,0,0,0)", true, d2 - d1 <= 1000);