| 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 | 4 |
| 5 // TODO(jmesserly): the native class should be the real JS Date. | 5 // TODO(jmesserly): the native class should be the real JS Date. |
| 6 // TODO(jimhug): Making the date value non-lazy might be a good path there. | 6 // TODO(jimhug): Making the date value non-lazy might be a good path there. |
| 7 class DateImplementation implements Date { | 7 class DateImplementation implements Date { |
| 8 final int value; | 8 final int value; |
| 9 final TimeZone timeZone; | 9 final TimeZone timeZone; |
| 10 | 10 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 const DateImplementation.fromEpoch(this.value, this.timeZone); | 100 const DateImplementation.fromEpoch(this.value, this.timeZone); |
| 101 | 101 |
| 102 bool operator ==(other) { | 102 bool operator ==(other) { |
| 103 if (!(other is DateImplementation)) return false; | 103 if (!(other is DateImplementation)) return false; |
| 104 return (value == other.value) && (timeZone == other.timeZone); | 104 return (value == other.value) && (timeZone == other.timeZone); |
| 105 } | 105 } |
| 106 | 106 |
| 107 bool operator <(Date other) => value < other.value; |
| 108 |
| 109 bool operator <=(Date other) => value <= other.value; |
| 110 |
| 111 bool operator >(Date other) => value > other.value; |
| 112 |
| 113 bool operator >=(Date other) => value >= other.value; |
| 114 |
| 107 int compareTo(Date other) { | 115 int compareTo(Date other) { |
| 108 return value.compareTo(other.value); | 116 return value.compareTo(other.value); |
| 109 } | 117 } |
| 110 | 118 |
| 111 int hashCode() { | 119 int hashCode() { |
| 112 return value; | 120 return value; |
| 113 } | 121 } |
| 114 | 122 |
| 115 Date changeTimeZone(TimeZone targetTimeZone) { | 123 Date changeTimeZone(TimeZone targetTimeZone) { |
| 116 if (targetTimeZone == null) { | 124 if (targetTimeZone == null) { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 return isUtc == other.isUtc; | 283 return isUtc == other.isUtc; |
| 276 } | 284 } |
| 277 | 285 |
| 278 String toString() { | 286 String toString() { |
| 279 if (isUtc) return "TimeZone (UTC)"; | 287 if (isUtc) return "TimeZone (UTC)"; |
| 280 return "TimeZone (Local)"; | 288 return "TimeZone (Local)"; |
| 281 } | 289 } |
| 282 | 290 |
| 283 final bool isUtc; | 291 final bool isUtc; |
| 284 } | 292 } |
| OLD | NEW |