Module: wine Branch: master Commit: fdd22f197ace226ceae8531c12651feb192b7619 URL: http://source.winehq.org/git/wine.git/?a=commit;h=fdd22f197ace226ceae8531c12...
Author: Thomas Faller tfaller1@gmx.de Date: Sun May 3 21:40:27 2015 +0200
jscript: Date.parse: long date with '/' or '-'.
---
dlls/jscript/date.c | 9 ++++++++- dlls/jscript/tests/api.js | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/jscript/date.c b/dlls/jscript/date.c index 5e5ef1c..6d98fcd 100644 --- a/dlls/jscript/date.c +++ b/dlls/jscript/date.c @@ -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) { diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index e1f91c0..f4f42b0 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -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);