Reviewers: ulan,

Description:
Default to UTC in the legacy date parser.

[email protected]
BUG=v8:2521


Please review this at https://chromiumcodereview.appspot.com/12178016/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/dateparser-inl.h
  A + test/mjsunit/regress/regress-2521.js


Index: src/dateparser-inl.h
diff --git a/src/dateparser-inl.h b/src/dateparser-inl.h
index 3cb36fa433998e96dbb9acadae999a791cc89277..4f74a088bd924ec1ea829cc06fa9aa57b48e4efb 100644
--- a/src/dateparser-inl.h
+++ b/src/dateparser-inl.h
@@ -178,7 +178,8 @@ bool DateParser::Parse(Vector<Char> str,
       // Ignore other characters and whitespace.
     }
   }
-
+ // Successfully parsed ES5 Date Time String. Default to UTC if no TZ given.
+  if (tz.IsEmpty()) tz.Set(0);
   return day.Write(out) && time.Write(out) && tz.Write(out);
 }

Index: test/mjsunit/regress/regress-2521.js
diff --git a/test/mjsunit/regress/regress-crbug-172345.js b/test/mjsunit/regress/regress-2521.js
similarity index 93%
copy from test/mjsunit/regress/regress-crbug-172345.js
copy to test/mjsunit/regress/regress-2521.js
index 711501caa791f2974635ac4dd894568a2e3fc982..55a4b6addbb6dcff27f39e4c1e0f353c9bf8d30a 100644
--- a/test/mjsunit/regress/regress-crbug-172345.js
+++ b/test/mjsunit/regress/regress-2521.js
@@ -25,10 +25,7 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-function f(a,i) {
-  return a[i];
-}
+var legacy = new Date("2013-2-31");
+var es5 = new Date("2013-02-31");
+assertEquals(es5.toString(), legacy.toString());

-f([1,2,3], "length");
-f([1,2,3], "length");
-f([1,2,3], 2);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to