[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:
parent
13626e97e0
commit
b0d0d57d2b
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
5
test/mjsunit/regress/regress-crbug-575082.js
Normal file
5
test/mjsunit/regress/regress-crbug-575082.js
Normal 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");
|
Loading…
Reference in New Issue
Block a user