Piotr Caban : jscript: Added string argument handling to Date constructor.
Alexandre Julliard
julliard at winehq.org
Mon Jul 6 09:33:58 CDT 2009
Module: wine
Branch: master
Commit: 8150960f8ccdd5e52c1d2f83f857b6c9114a734e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8150960f8ccdd5e52c1d2f83f857b6c9114a734e
Author: Piotr Caban <piotr.caban at gmail.com>
Date: Mon Jul 6 10:38:08 2009 +0200
jscript: Added string argument handling to Date constructor.
---
dlls/jscript/date.c | 9 ++++-----
dlls/jscript/tests/api.js | 2 ++
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/dlls/jscript/date.c b/dlls/jscript/date.c
index d43708a..aa06f4e 100644
--- a/dlls/jscript/date.c
+++ b/dlls/jscript/date.c
@@ -2617,12 +2617,11 @@ static HRESULT DateConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPP
if(FAILED(hres))
return hres;
- if(V_VT(&prim) == VT_BSTR) {
- FIXME("VT_BSTR not supported\n");
- return E_NOTIMPL;
- }
+ if(V_VT(&prim) == VT_BSTR)
+ hres = date_parse(V_BSTR(&prim), &num);
+ else
+ hres = to_number(dispex->ctx, &prim, ei, &num);
- hres = to_number(dispex->ctx, &prim, ei, &num);
VariantClear(&prim);
if(FAILED(hres))
return hres;
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
index 27eabfc..b76e94b 100644
--- a/dlls/jscript/tests/api.js
+++ b/dlls/jscript/tests/api.js
@@ -940,6 +940,8 @@ date = new Date(8.64e15+1);
ok(isNaN(0+date.getTime()), "date.getTime() is not NaN");
date = new Date(Infinity);
ok(isNaN(0+date.getTime()), "date.getTime() is not NaN");
+date = new Date("3 July 2009 22:28:00 UTC+0100");
+ok(date.getTime() === 1246656480000, "date.getTime() = " + date.getTime());
date = new Date(1984, 11, 29, 13, 51, 24, 120);
ok(date.getFullYear() === 1984, "date.getFullYear() = " + date.getFullYear());
ok(date.getMonth() === 11, "date.getMonth() = " + date.getMonth());
More information about the wine-cvs
mailing list