OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_DATEPARSER_INL_H_ | 5 #ifndef V8_DATEPARSER_INL_H_ |
6 #define V8_DATEPARSER_INL_H_ | 6 #define V8_DATEPARSER_INL_H_ |
7 | 7 |
8 #include "src/char-predicates-inl.h" | 8 #include "src/char-predicates-inl.h" |
9 #include "src/dateparser.h" | 9 #include "src/dateparser.h" |
10 #include "src/unicode-cache-inl.h" | 10 #include "src/unicode-cache-inl.h" |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 if (!scanner->SkipSymbol(':')) return DateToken::Invalid(); | 336 if (!scanner->SkipSymbol(':')) return DateToken::Invalid(); |
337 if (!scanner->Peek().IsFixedLengthNumber(2) || | 337 if (!scanner->Peek().IsFixedLengthNumber(2) || |
338 !TimeComposer::IsMinute(scanner->Peek().number())) { | 338 !TimeComposer::IsMinute(scanner->Peek().number())) { |
339 return DateToken::Invalid(); | 339 return DateToken::Invalid(); |
340 } | 340 } |
341 tz->SetAbsoluteMinute(scanner->Next().number()); | 341 tz->SetAbsoluteMinute(scanner->Next().number()); |
342 } | 342 } |
343 } | 343 } |
344 if (!scanner->Peek().IsEndOfInput()) return DateToken::Invalid(); | 344 if (!scanner->Peek().IsEndOfInput()) return DateToken::Invalid(); |
345 } | 345 } |
346 // Successfully parsed ES5 Date Time String. Default to UTC if no TZ given. | 346 // Successfully parsed ES5 Date Time String. |
347 if (tz->IsEmpty()) tz->Set(0); | 347 // ES#sec-date-time-string-format Date Time String Format |
| 348 // "When the time zone offset is absent, date-only forms are interpreted |
| 349 // as a UTC time and date-time forms are interpreted as a local time." |
| 350 if (tz->IsEmpty() && time->IsEmpty()) { |
| 351 tz->Set(0); |
| 352 } |
348 day->set_iso_date(); | 353 day->set_iso_date(); |
349 return DateToken::EndOfInput(); | 354 return DateToken::EndOfInput(); |
350 } | 355 } |
351 | 356 |
352 | 357 |
353 } // namespace internal | 358 } // namespace internal |
354 } // namespace v8 | 359 } // namespace v8 |
355 | 360 |
356 #endif // V8_DATEPARSER_INL_H_ | 361 #endif // V8_DATEPARSER_INL_H_ |
OLD | NEW |