| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 105 } |
| 106 | 106 |
| 107 const DateImplementation.fromEpoch(int this.value, | 107 const DateImplementation.fromEpoch(int this.value, |
| 108 TimeZone this.timeZone); | 108 TimeZone this.timeZone); |
| 109 | 109 |
| 110 bool operator ==(Object other) { | 110 bool operator ==(Object other) { |
| 111 if (!(other is DateImplementation)) return false; | 111 if (!(other is DateImplementation)) return false; |
| 112 return value == other.value && timeZone == other.timeZone; | 112 return value == other.value && timeZone == other.timeZone; |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool operator <(Date other) => value < other.value; |
| 116 |
| 117 bool operator <=(Date other) => value <= other.value; |
| 118 |
| 119 bool operator >(Date other) => value > other.value; |
| 120 |
| 121 bool operator >=(Date other) => value >= other.value; |
| 122 |
| 115 int compareTo(Date other) => value.compareTo(other.value); | 123 int compareTo(Date other) => value.compareTo(other.value); |
| 116 int hashCode() => value; | 124 int hashCode() => value; |
| 117 | 125 |
| 118 Date changeTimeZone(TimeZone targetTimeZone) { | 126 Date changeTimeZone(TimeZone targetTimeZone) { |
| 119 if (targetTimeZone === null) { | 127 if (targetTimeZone === null) { |
| 120 targetTimeZone = new TimeZoneImplementation.local(); | 128 targetTimeZone = new TimeZoneImplementation.local(); |
| 121 } | 129 } |
| 122 return new Date.fromEpoch(value, targetTimeZone); | 130 return new Date.fromEpoch(value, targetTimeZone); |
| 123 } | 131 } |
| 124 | 132 |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 | 414 |
| 407 static int getHours_(int secondsSinceEpoch, bool isUtc) | 415 static int getHours_(int secondsSinceEpoch, bool isUtc) |
| 408 native "DateNatives_getHours"; | 416 native "DateNatives_getHours"; |
| 409 | 417 |
| 410 static int getMinutes_(int secondsSinceEpoch, bool isUtc) | 418 static int getMinutes_(int secondsSinceEpoch, bool isUtc) |
| 411 native "DateNatives_getMinutes"; | 419 native "DateNatives_getMinutes"; |
| 412 | 420 |
| 413 static int getSeconds_(int secondsSinceEpoch, bool isUtc) | 421 static int getSeconds_(int secondsSinceEpoch, bool isUtc) |
| 414 native "DateNatives_getSeconds"; | 422 native "DateNatives_getSeconds"; |
| 415 } | 423 } |
| OLD | NEW |