]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - runtime/DateConversion.cpp
JavaScriptCore-903.5.tar.gz
[apple/javascriptcore.git] / runtime / DateConversion.cpp
index 70dbaa0306362cbb5d698336be7877f7f189ce48..1418876ed1492c1dce52ad9d7a80936a6ca8bc1e 100644 (file)
 #include "DateConversion.h"
 
 #include "CallFrame.h"
+#include "JSObject.h"
+#include "ScopeChain.h"
 #include "UString.h"
 #include <wtf/DateMath.h>
 #include <wtf/StringExtras.h>
+#include <wtf/text/CString.h>
 
 using namespace WTF;
 
@@ -56,7 +59,9 @@ double parseDate(ExecState* exec, const UString &date)
 {
     if (date == exec->globalData().cachedDateString)
         return exec->globalData().cachedDateStringValue;
-    double value = parseDateFromNullTerminatedCharacters(exec, date.UTF8String().data());
+    double value = parseES5DateFromNullTerminatedCharacters(date.utf8().data());
+    if (isnan(value))
+        value = parseDateFromNullTerminatedCharacters(exec, date.utf8().data());
     exec->globalData().cachedDateString = date;
     exec->globalData().cachedDateStringValue = value;
     return value;