Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(572)

Unified Diff: src/dateparser-inl.h

Issue 2648603002: [builtins] Apply ES2016 conditional default timezone semantics (Closed)
Patch Set: Clean up tests Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/date.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/dateparser-inl.h
diff --git a/src/dateparser-inl.h b/src/dateparser-inl.h
index 47a7c6e7ff1e8c8f1b574ad8478574ad80be3d49..fd4bed2df6a7071a2138012ff575960baffa8ce0 100644
--- a/src/dateparser-inl.h
+++ b/src/dateparser-inl.h
@@ -343,8 +343,13 @@ DateParser::DateToken DateParser::ParseES5DateTime(
}
if (!scanner->Peek().IsEndOfInput()) return DateToken::Invalid();
}
- // Successfully parsed ES5 Date Time String. Default to UTC if no TZ given.
- if (tz->IsEmpty()) tz->Set(0);
+ // Successfully parsed ES5 Date Time String.
+ // ES#sec-date-time-string-format Date Time String Format
+ // "When the time zone offset is absent, date-only forms are interpreted
+ // as a UTC time and date-time forms are interpreted as a local time."
+ if (tz->IsEmpty() && time->IsEmpty()) {
+ tz->Set(0);
+ }
day->set_iso_date();
return DateToken::EndOfInput();
}
« no previous file with comments | « no previous file | test/mjsunit/date.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698