jscript: Date.parse: long date with '/' or '-'.
This commit is contained in:
parent
49958f83f1
commit
fdd22f197a
|
@ -2132,7 +2132,7 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
|
|||
}
|
||||
}
|
||||
else if(parse[i]=='-' || parse[i]=='/') {
|
||||
/* Short date */
|
||||
/* Short or long date */
|
||||
if(set_day || set_month || set_year) break;
|
||||
set_day = TRUE;
|
||||
set_month = TRUE;
|
||||
|
@ -2152,6 +2152,13 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
|
|||
if(parse[i]<'0' || parse[i]>'9') break;
|
||||
year = atoiW(&parse[i]);
|
||||
while(parse[i]>='0' && parse[i]<='9') i++;
|
||||
|
||||
if(tmp >= 70){
|
||||
/* long date */
|
||||
month = day - 1;
|
||||
day = year;
|
||||
year = tmp;
|
||||
}
|
||||
}
|
||||
else if(tmp<0) break;
|
||||
else if(tmp<70) {
|
||||
|
|
|
@ -2013,6 +2013,8 @@ ok(Date.parse("February 31 UTC, 2000 12:31:17 PM") === 952000277000,
|
|||
"Date.parse(\"February 31 UTC, 2000 12:31:17 PM\") = " + Date.parse("February 31 UTC, 2000 12:31:17 PM"));
|
||||
ok(Date.parse("71 11:32AM Dec 12 UTC BC ") === -64346358480000, "Date.parse(\"71 11:32AM Dec 12 UTC BC \") = " + Date.parse("71 11:32AM Dec 12 UTC BC "));
|
||||
ok(Date.parse("23/71/2000 11::32::UTC") === 1010662320000, "Date.parse(\"23/71/2000 11::32::UTC\") = " + Date.parse("23/71/2000 11::32::UTC"));
|
||||
ok(Date.parse("1970/01/01") === Date.parse("01/01/1970"), "Date.parse(\"1970/01/01\") = " + Date.parse("1970/01/01"));
|
||||
ok(Date.parse("71/12/14") === Date.parse("12/14/1971"), "Date.parse(\"71/12/14\") = " + Date.parse("71/12/14"));
|
||||
|
||||
ok(typeof(Math.PI) === "number", "typeof(Math.PI) = " + typeof(Math.PI));
|
||||
ok(Math.floor(Math.PI*100) === 314, "Math.PI = " + Math.PI);
|
||||
|
|
Loading…
Reference in New Issue