| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // Dart core library. | 4 // Dart core library. |
| 5 | 5 |
| 6 class TimeZoneImplementation implements TimeZone { | 6 class TimeZoneImplementation implements TimeZone { |
| 7 const TimeZoneImplementation.utc() : isUtc = true; | 7 const TimeZoneImplementation.utc() : isUtc = true; |
| 8 TimeZoneImplementation.local() : isUtc = false {} | 8 TimeZoneImplementation.local() : isUtc = false {} |
| 9 | 9 |
| 10 bool operator ==(Object other) { | 10 bool operator ==(Object other) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // Read in (a subset of) ISO 8601. | 54 // Read in (a subset of) ISO 8601. |
| 55 // Examples: | 55 // Examples: |
| 56 // - "2012-02-27 13:27:00" | 56 // - "2012-02-27 13:27:00" |
| 57 // - "2012-02-27 13:27:00.423z" | 57 // - "2012-02-27 13:27:00.423z" |
| 58 // - "20120227 13:27:00" | 58 // - "20120227 13:27:00" |
| 59 // - "20120227T132700" | 59 // - "20120227T132700" |
| 60 // - "20120227" | 60 // - "20120227" |
| 61 // - "2012-02-27T14Z" | 61 // - "2012-02-27T14Z" |
| 62 // - "-123450101 00:00:00 Z" // In the year -12345. | 62 // - "-123450101 00:00:00 Z" // In the year -12345. |
| 63 final RegExp re = const RegExp( | 63 final RegExp re = const RegExp( |
| 64 @'^([+-]?\d?\d\d\d\d)-?(\d\d)-?(\d\d)' + // The day part. | 64 @'^([+-]?\d?\d\d\d\d)-?(\d\d)-?(\d\d)' // The day part. |
| 65 @'(?:[ T](\d\d)(?::?(\d\d)(?::?(\d\d)(.\d{1,6})?)?)? ?([zZ])?)?$'); | 65 @'(?:[ T](\d\d)(?::?(\d\d)(?::?(\d\d)(.\d{1,6})?)?)? ?([zZ])?)?$'); |
| 66 Match match = re.firstMatch(formattedString); | 66 Match match = re.firstMatch(formattedString); |
| 67 if (match !== null) { | 67 if (match !== null) { |
| 68 int parseIntOrZero(String matched) { | 68 int parseIntOrZero(String matched) { |
| 69 // TODO(floitsch): we should not need to test against the empty string. | 69 // TODO(floitsch): we should not need to test against the empty string. |
| 70 if (matched === null || matched == "") return 0; | 70 if (matched === null || matched == "") return 0; |
| 71 return Math.parseInt(matched); | 71 return Math.parseInt(matched); |
| 72 } | 72 } |
| 73 | 73 |
| 74 double parseDoubleOrZero(String matched) { | 74 double parseDoubleOrZero(String matched) { |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 414 |
| 415 static int _getHours(int secondsSinceEpoch, bool isUtc) | 415 static int _getHours(int secondsSinceEpoch, bool isUtc) |
| 416 native "DateNatives_getHours"; | 416 native "DateNatives_getHours"; |
| 417 | 417 |
| 418 static int _getMinutes(int secondsSinceEpoch, bool isUtc) | 418 static int _getMinutes(int secondsSinceEpoch, bool isUtc) |
| 419 native "DateNatives_getMinutes"; | 419 native "DateNatives_getMinutes"; |
| 420 | 420 |
| 421 static int _getSeconds(int secondsSinceEpoch, bool isUtc) | 421 static int _getSeconds(int secondsSinceEpoch, bool isUtc) |
| 422 native "DateNatives_getSeconds"; | 422 native "DateNatives_getSeconds"; |
| 423 } | 423 } |
| OLD | NEW |