new Date(NaN)

Maciej Stachowiak mjs at apple.com
Fri Nov 21 10:00:27 CET 2003


On Nov 20, 2003, at 2:02 PM, Harri Porten wrote:

> Hi,
>
> last time I checked the Date implementation was different in
> JavaScriptCore. Not sure whether the attached patch is required. In 
> kjs it
> fixes all Date getter functions to return NaN if the date value is NaN
> itself.

This is what we have in JavaScriptCore. Darin did this based on testing 
OmniWeb and Mozilla.

  if (isNaN(milli)) {
     switch (id) {
       case ToString:
       case ToDateString:
       case ToTimeString:
       case ToGMTString:
       case ToUTCString:
       case ToLocaleString:
       case ToLocaleDateString:
       case ToLocaleTimeString:
         return String("Invalid Date");
       case ValueOf:
       case GetTime:
       case GetYear:
       case GetFullYear:
       case GetMonth:
       case GetDate:
       case GetDay:
       case GetHours:
       case GetMinutes:
       case GetSeconds:
       case GetMilliSeconds:
       case GetTimezoneOffset:
         return Number(NaN);
     }
   }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2355 bytes
Desc: not available
Url : https://mail.kde.org/mailman/private/khtml-devel/attachments/20031121/2953fff6/smime.bin


More information about the Khtml-devel mailing list