var VERSION = 9706;
startTest();
var SECTION = "15.9.2.2";
- var TOLERANCE = 100;
var TITLE = "The Date Constructor Called as a Function";
writeHeaderToLog(SECTION+" "+TITLE );
var array = new Array();
var item = 0;
+ // allow up to 1 second difference due to possibility
+ // the date may change by 1 second in between calls to Date
+
+ var d1;
+ var d2;
+
// Dates around feb 29, 2000
- array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0));
- array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59));
- array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0));
+ d1 = new Date();
+ d2 = Date.parse(Date(2000,1,29,0,0,0));
+ array[item++] = new TestCase(SECTION, "Date(2000,1,29,0,0,0)", true, d2 - d1 <= 1000);
-/*
- // Dates around jan 1, 2005
- array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59));
- array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0));
+ d1 = new Date();
+ d2 = Date.parse(Date(2000,1,28,23,59,59));
+ array[item++] = new TestCase(SECTION, "Date(2000,1,28,23,59,59)", true, d2 - d1 <= 1000);
+
+ d1 = new Date();
+ d2 = Date.parse(Date(2000,1,27,16,0,0));
+ array[item++] = new TestCase(SECTION, "Date(2000,1,27,16,0,0)", true, d2 - d1 <= 1000);
- // Dates around jan 1, 2032
- array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
- array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
-*/
return ( array );
}
function test() {