| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 } | 115 } |
| 116 | 116 |
| 117 const DateImplementation.fromEpoch(int this.value, | 117 const DateImplementation.fromEpoch(int this.value, |
| 118 TimeZone this.timeZone); | 118 TimeZone this.timeZone); |
| 119 | 119 |
| 120 bool operator ==(Object other) { | 120 bool operator ==(Object other) { |
| 121 if (!(other is DateImplementation)) return false; | 121 if (!(other is DateImplementation)) return false; |
| 122 return value == other.value && timeZone == other.timeZone; | 122 return value == other.value && timeZone == other.timeZone; |
| 123 } | 123 } |
| 124 | 124 |
| 125 int compareTo(Date other) { | 125 int compareTo(Date other) => value.compareTo(other.value); |
| 126 return value.compareTo(other.value); | 126 int hashCode() => value; |
| 127 } | |
| 128 | 127 |
| 129 Date changeTimeZone(TimeZone targetTimeZone) { | 128 Date changeTimeZone(TimeZone targetTimeZone) { |
| 130 if (targetTimeZone === null) { | 129 if (targetTimeZone === null) { |
| 131 targetTimeZone = new TimeZoneImplementation.local(); | 130 targetTimeZone = new TimeZoneImplementation.local(); |
| 132 } | 131 } |
| 133 return new Date.fromEpoch(value, targetTimeZone); | 132 return new Date.fromEpoch(value, targetTimeZone); |
| 134 } | 133 } |
| 135 | 134 |
| 136 int get year() { | 135 int get year() { |
| 137 int secondsSinceEpoch = secondsSinceEpoch_; | 136 int secondsSinceEpoch = secondsSinceEpoch_; |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 416 |
| 418 static int getHours_(int secondsSinceEpoch, bool isUtc) | 417 static int getHours_(int secondsSinceEpoch, bool isUtc) |
| 419 native "DateNatives_getHours"; | 418 native "DateNatives_getHours"; |
| 420 | 419 |
| 421 static int getMinutes_(int secondsSinceEpoch, bool isUtc) | 420 static int getMinutes_(int secondsSinceEpoch, bool isUtc) |
| 422 native "DateNatives_getMinutes"; | 421 native "DateNatives_getMinutes"; |
| 423 | 422 |
| 424 static int getSeconds_(int secondsSinceEpoch, bool isUtc) | 423 static int getSeconds_(int secondsSinceEpoch, bool isUtc) |
| 425 native "DateNatives_getSeconds"; | 424 native "DateNatives_getSeconds"; |
| 426 } | 425 } |
| OLD | NEW |