[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}
This commit is contained in:
bmeurer 2016-01-07 01:30:36 -08:00 committed by Commit bot
parent 13626e97e0
commit b0d0d57d2b
3 changed files with 9 additions and 2 deletions

View File

@ -2096,7 +2096,9 @@ double ParseDateTimeString(Handle<String> str) {
tmp->get(5)->Number(), tmp->get(6)->Number());
double date = MakeDate(day, time);
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 {
date -= tmp->get(7)->Number() * 1000.0;
}

View File

@ -71,7 +71,7 @@ void DateCache::YearMonthDayFromDays(
*year = 400 * (days / kDaysIn400Years) - kYearsOffset;
days %= kDaysIn400Years;
DCHECK(DaysFromYearMonth(*year, 0) + days == save_days);
DCHECK_EQ(save_days, DaysFromYearMonth(*year, 0) + days);
days--;
int yd1 = days / kDaysIn100Years;

View File

@ -0,0 +1,5 @@
// 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");