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

Side by Side Diff: src/dateparser-inl.h

Issue 12178016: Default to UTC in the legacy date parser. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2521.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 tz.SetAbsoluteMinute(n % 100); 171 tz.SetAbsoluteMinute(n % 100);
172 } 172 }
173 } else if ((token.IsAsciiSign() || token.IsSymbol(')')) && 173 } else if ((token.IsAsciiSign() || token.IsSymbol(')')) &&
174 has_read_number) { 174 has_read_number) {
175 // Extra sign or ')' is illegal if a number has been read. 175 // Extra sign or ')' is illegal if a number has been read.
176 return false; 176 return false;
177 } else { 177 } else {
178 // Ignore other characters and whitespace. 178 // Ignore other characters and whitespace.
179 } 179 }
180 } 180 }
181 181 // Successfully parsed ES5 Date Time String. Default to UTC if no TZ given.
182 if (tz.IsEmpty()) tz.Set(0);
182 return day.Write(out) && time.Write(out) && tz.Write(out); 183 return day.Write(out) && time.Write(out) && tz.Write(out);
183 } 184 }
184 185
185 186
186 template<typename CharType> 187 template<typename CharType>
187 DateParser::DateToken DateParser::DateStringTokenizer<CharType>::Scan() { 188 DateParser::DateToken DateParser::DateStringTokenizer<CharType>::Scan() {
188 int pre_pos = in_->position(); 189 int pre_pos = in_->position();
189 if (in_->IsEnd()) return DateToken::EndOfInput(); 190 if (in_->IsEnd()) return DateToken::EndOfInput();
190 if (in_->IsAsciiDigit()) { 191 if (in_->IsAsciiDigit()) {
191 int n = in_->ReadUnsignedNumeral(); 192 int n = in_->ReadUnsignedNumeral();
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 // Successfully parsed ES5 Date Time String. Default to UTC if no TZ given. 326 // Successfully parsed ES5 Date Time String. Default to UTC if no TZ given.
326 if (tz->IsEmpty()) tz->Set(0); 327 if (tz->IsEmpty()) tz->Set(0);
327 day->set_iso_date(); 328 day->set_iso_date();
328 return DateToken::EndOfInput(); 329 return DateToken::EndOfInput();
329 } 330 }
330 331
331 332
332 } } // namespace v8::internal 333 } } // namespace v8::internal
333 334
334 #endif // V8_DATEPARSER_INL_H_ 335 #endif // V8_DATEPARSER_INL_H_
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2521.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698