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/. */
6
//-----------------------------------------------------------------------------
7
var BUGNUMBER = 301738;
8
var summary = 'Date parse compatibilty with MSIE';
12
printBugNumber(BUGNUMBER);
13
printStatus (summary);
16
Case 2. The input string is of the form "f/m/l" where f, m and l are
17
integers, e.g. 7/16/45.
18
Adjust the mon, mday and year values to achieve 100% MSIE
20
a. If 0 <= f < 70, f/m/l is interpreted as month/day/year.
21
i. If year < 100, it is the number of years after 1900
22
ii. If year >= 100, it is the number of years after 0.
24
i. If m < 70, f/m/l is interpreted as
25
year/month/day where year is the number of years after
27
ii. If m >= 70, the date is invalid.
29
i. If m < 70, f/m/l is interpreted as
30
year/month/day where year is the number of years after 0.
31
ii. If m >= 70, the date is invalid.
38
function newDate(f, m, l)
40
return new Date(f + '/' + m + '/' + l);
43
function newDesc(f, m, l)
45
return f + '/' + m + '/' + l;
53
expect = (new Date(l, f-1, m)).toDateString();
54
actual = newDate(f, m, l).toDateString();
55
reportCompare(expect, actual, newDesc(f, m, l));
61
expect = (new Date(l, f-1, m)).toDateString();
62
actual = newDate(f, m, l).toDateString();
63
reportCompare(expect, actual, newDesc(f, m, l));
70
expect = (new Date(l, f-1, m)).toDateString();
71
actual = newDate(f, m, l).toDateString();
72
reportCompare(expect, actual, newDesc(f, m, l));
78
expect = (new Date(l, f-1, m)).toDateString();
79
actual = newDate(f, m, l).toDateString();
80
reportCompare(expect, actual, newDesc(f, m, l));
88
expect = (new Date(f, m-1, l)).toDateString();
89
actual = newDate(f, m, l).toDateString();
90
reportCompare(expect, actual, newDesc(f, m, l));
96
expect = (new Date(f, m-1, l)).toDateString();
97
actual = newDate(f, m, l).toDateString();
98
reportCompare(expect, actual, newDesc(f, m, l));
107
actual = isNaN(newDate(f, m, l));
108
reportCompare(expect, actual, newDesc(f, m, l) + ' is an invalid date');
116
expect = (new Date(f, m-1, l)).toDateString();
117
actual = newDate(f, m, l).toDateString();
118
reportCompare(expect, actual, newDesc(f, m, l));
127
actual = isNaN(newDate(f, m, l));
128
reportCompare(expect, actual, newDesc(f, m, l) + ' is an invalid date');