Commit 13748990 authored by darin's avatar darin

Reviewed by Ken.

	- rolled in a change from the KJS folks

	Fixes a bug where the date functions would not accept non-strings.
	And provides a bit of a speedup.

        * kjs/date_object.h: Change parameter type for parseDate.
        * kjs/date_object.cpp:
        (DateObjectFuncImp::call): Always call toString, don't check the type.
        (KJS::parseDate): Take a UString parameter, not a String parameter.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3327 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c12a0350
2003-01-14 Darin Adler <darin@apple.com>
Reviewed by Ken.
- rolled in a change from the KJS folks
Fixes a bug where the date functions would not accept non-strings.
And provides a bit of a speedup.
* kjs/date_object.h: Change parameter type for parseDate.
* kjs/date_object.cpp:
(DateObjectFuncImp::call): Always call toString, don't check the type.
(KJS::parseDate): Take a UString parameter, not a String parameter.
2003-01-13 Darin Adler <darin@apple.com>
* kjs/ustring.h: Fix spelling of occurrence.
......
2003-01-14 Darin Adler <darin@apple.com>
Reviewed by Ken.
- rolled in a change from the KJS folks
Fixes a bug where the date functions would not accept non-strings.
And provides a bit of a speedup.
* kjs/date_object.h: Change parameter type for parseDate.
* kjs/date_object.cpp:
(DateObjectFuncImp::call): Always call toString, don't check the type.
(KJS::parseDate): Take a UString parameter, not a String parameter.
2003-01-13 Darin Adler <darin@apple.com>
* kjs/ustring.h: Fix spelling of occurrence.
......
......@@ -674,10 +674,7 @@ bool DateObjectFuncImp::implementsCall() const
Value DateObjectFuncImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
{
if (id == Parse) {
if (args[0].type() == StringType)
return parseDate(args[0].toString(exec));
else
return Number(NaN);
return parseDate(args[0].toString(exec));
}
else { // UTC
struct tm t;
......@@ -710,9 +707,8 @@ Value DateObjectFuncImp::call(ExecState *exec, Object &/*thisObj*/, const List &
// -----------------------------------------------------------------------------
Value KJS::parseDate(const String &s)
Value KJS::parseDate(const UString &u)
{
UString u = s.value();
#ifdef KJS_VERBOSE
fprintf(stderr,"KJS::parseDate %s\n",u.ascii());
#endif
......
......@@ -119,7 +119,7 @@ namespace KJS {
};
// helper functions
Value parseDate(const String &s);
Value parseDate(const UString &u);
time_t KRFCDate_parseDate(const UString &_date);
Value timeClip(const Value &t);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment