mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-27 04:05:32 +00:00
Bug 1550949: Disallow time-only version of ISO8601 r=arai
ES5.1 removed time-only format T00:00:00 and no other browsers support it. So this diff removes the support from gecko. Differential Revision: https://phabricator.services.mozilla.com/D31253 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
fe2eba08c1
commit
d0af199f76
@ -963,7 +963,7 @@ static bool ParseISOStyleDate(const CharT* s, size_t length,
|
||||
}
|
||||
++i;
|
||||
NEED_NDIGITS(6, year);
|
||||
} else if (!PEEK('T')) {
|
||||
} else {
|
||||
NEED_NDIGITS(4, year);
|
||||
}
|
||||
DONE_DATE_UNLESS('-');
|
||||
@ -1051,6 +1051,7 @@ done:
|
||||
#undef NEED
|
||||
#undef DONE_UNLESS
|
||||
#undef NEED_NDIGITS
|
||||
#undef NEED_NDIGITS_OR_LESS
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
|
@ -65,9 +65,9 @@ function test()
|
||||
check("2009T19:53:21+12:00", dd(2009,1,1,7,53,21,0));
|
||||
check("2009T19:53+12:00", dd(2009,1,1,7,53,0,0));
|
||||
|
||||
check("T19:53:21.001+12:00", dd(1970,1,1,7,53,21,1));
|
||||
check("T19:53:21+12:00", dd(1970,1,1,7,53,21,0));
|
||||
check("T19:53+12:00", dd(1970,1,1,7,53,0,0));
|
||||
checkInvalid("T19:53:21.001+12:00");
|
||||
checkInvalid("T19:53:21+12:00");
|
||||
checkInvalid("T19:53+12:00");
|
||||
|
||||
// formats without timezone uses the timezone as at that date
|
||||
check("2009-07-23T19:53:21.001", dd(2009,7,23,19,53,21,1)+Jul2009TZ);
|
||||
@ -82,9 +82,9 @@ function test()
|
||||
check("2009T19:53:21", dd(2009,1,1,19,53,21,0)+Jan2009TZ);
|
||||
check("2009T19:53", dd(2009,1,1,19,53,0,0)+Jan2009TZ);
|
||||
|
||||
check("T19:53:21.001", dd(1970,1,1,19,53,21,1)+Jan1970TZ);
|
||||
check("T19:53:21", dd(1970,1,1,19,53,21,0)+Jan1970TZ);
|
||||
check("T19:53", dd(1970,1,1,19,53,0,0)+Jan1970TZ);
|
||||
checkInvalid("T19:53:21.001");
|
||||
checkInvalid("T19:53:21");
|
||||
checkInvalid("T19:53");
|
||||
|
||||
// with no time at all assume UTC
|
||||
check("2009-07-23", dd(2009,7,23,0,0,0,0));
|
||||
|
@ -39,7 +39,7 @@ assertEq(new Date("1997-03-08 1:1:01").getTime(),
|
||||
assertEq(new Date("1997-03-08 1:1:1").getTime(),
|
||||
new Date("1997-03-08T1:1:1").getTime());
|
||||
assertEq(new Date("1997-03-08 11").getTime(),
|
||||
new Date("1997-03-08T11").getTime());
|
||||
new Date("1997-03-08T11").getTime()); // Date(NaN)
|
||||
assertEq(new Date("1997-03-08").getTime(),
|
||||
new Date("1997-03-08").getTime());
|
||||
assertEq(new Date("1997-03-8").getTime(),
|
||||
|
Loading…
Reference in New Issue
Block a user