Bug 26594 - JSC needs to support Date.toISOString
: JSC needs to support Date.toISOString
Status: RESOLVED FIXED
: WebKit
JavaScriptCore
: 528+ (Nightly build)
: Macintosh Mac OS X 10.5
: P2 Normal
Assigned To:
:
:
:
: 26592
  Show dependency treegraph
 
Reported: 2009-06-21 18:23 PST by
Modified: 2009-06-21 22:08 PST (History)


Attachments
Support Date.toISOString (5.78 KB, patch)
2009-06-21 18:38 PST, Oliver Hunt
no flags Review Patch | Details | Formatted Diff | Diff
Updated patch (6.39 KB, patch)
2009-06-21 19:12 PST, Oliver Hunt
sam: review+
Review Patch | Details | Formatted Diff | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2009-06-21 18:23:57 PST
Date.toJSON depends on Date.toISOString
------- Comment #1 From 2009-06-21 18:38:14 PST -------
Created an attachment (id=31627) [details]
Support Date.toISOString
------- Comment #2 From 2009-06-21 19:12:52 PST -------
Created an attachment (id=31628) [details]
Updated patch
------- Comment #3 From 2009-06-21 21:02:12 PST -------
(From update of attachment 31628 [details])
> +    
> +    const bool utc = true;
> +    
> +    DateInstance* thisDateObj = asDateInstance(thisValue); 
> +    double milli = thisDateObj->internalNumber();
> +    if (isnan(milli))
> +        return jsNontrivialString(exec, "Invalid Date");

According to http://wiki.ecmascript.org/lib/exe/fetch.php?id=es3.1%3Aes3.1_proposal_working_draft&cache=cache&media=es3.1:es5_candidate_errata_june_17.pdf, we should throwing a RangeError for non-finite values.

> +    
> +    GregorianDateTime t;
> +    thisDateObj->msToGregorianDateTime(milli, true, t);

I believe the intent of the utc constant is to use it here instead of passing true.


r- for the isnan bit.
------- Comment #4 From 2009-06-21 22:01:22 PST -------
(From update of attachment 31628 [details])
Oliver and I discussed this a bit on IRC.
------- Comment #5 From 2009-06-21 22:01:53 PST -------
(From update of attachment 31628 [details])
Oliver and I discussed this a bit on IRC.
------- Comment #6 From 2009-06-21 22:08:38 PST -------
Committing to http://svn.webkit.org/repository/webkit/trunk ...
    M    JavaScriptCore/ChangeLog
    M    JavaScriptCore/runtime/DatePrototype.cpp
    M    LayoutTests/ChangeLog
    A    LayoutTests/fast/js/date-toisostring-expected.txt
    A    LayoutTests/fast/js/date-toisostring.html
    A    LayoutTests/fast/js/resources/date-toisostring.js
Committed r44929