Commit b0d0d57d authored by bmeurer's avatar bmeurer Committed by Commit bot

[date] Date parser says true even for wrong dates, check twice.

R=yangguo@chromium.org
BUG=chromium:575082
LOG=n

Review URL: https://codereview.chromium.org/1566973002

Cr-Commit-Position: refs/heads/master@{#33149}
parent 13626e97
...@@ -2096,7 +2096,9 @@ double ParseDateTimeString(Handle<String> str) { ...@@ -2096,7 +2096,9 @@ double ParseDateTimeString(Handle<String> str) {
tmp->get(5)->Number(), tmp->get(6)->Number()); tmp->get(5)->Number(), tmp->get(6)->Number());
double date = MakeDate(day, time); double date = MakeDate(day, time);
if (tmp->get(7)->IsNull()) { if (tmp->get(7)->IsNull()) {
date = isolate->date_cache()->ToUTC(static_cast<int64_t>(date)); if (!std::isnan(date)) {
date = isolate->date_cache()->ToUTC(static_cast<int64_t>(date));
}
} else { } else {
date -= tmp->get(7)->Number() * 1000.0; date -= tmp->get(7)->Number() * 1000.0;
} }
......
...@@ -71,7 +71,7 @@ void DateCache::YearMonthDayFromDays( ...@@ -71,7 +71,7 @@ void DateCache::YearMonthDayFromDays(
*year = 400 * (days / kDaysIn400Years) - kYearsOffset; *year = 400 * (days / kDaysIn400Years) - kYearsOffset;
days %= kDaysIn400Years; days %= kDaysIn400Years;
DCHECK(DaysFromYearMonth(*year, 0) + days == save_days); DCHECK_EQ(save_days, DaysFromYearMonth(*year, 0) + days);
days--; days--;
int yd1 = days / kDaysIn100Years; int yd1 = days / kDaysIn100Years;
......
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var y = new Date("-1073741824");
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