OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 class DateImplementation implements Date { | 5 class DateImplementation implements Date { |
6 final int millisecondsSinceEpoch; | 6 final int millisecondsSinceEpoch; |
7 final bool isUtc; | 7 final bool isUtc; |
8 | 8 |
9 factory DateImplementation.fromString(String formattedString) { | 9 factory DateImplementation.fromString(String formattedString) { |
10 // Read in (a subset of) ISO 8601. | 10 // Read in (a subset of) ISO 8601. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 bool operator >(Date other) | 84 bool operator >(Date other) |
85 => millisecondsSinceEpoch > other.millisecondsSinceEpoch; | 85 => millisecondsSinceEpoch > other.millisecondsSinceEpoch; |
86 | 86 |
87 bool operator >=(Date other) | 87 bool operator >=(Date other) |
88 => millisecondsSinceEpoch >= other.millisecondsSinceEpoch; | 88 => millisecondsSinceEpoch >= other.millisecondsSinceEpoch; |
89 | 89 |
90 int compareTo(Date other) | 90 int compareTo(Date other) |
91 => millisecondsSinceEpoch.compareTo(other.millisecondsSinceEpoch); | 91 => millisecondsSinceEpoch.compareTo(other.millisecondsSinceEpoch); |
92 | 92 |
93 int hashCode() => millisecondsSinceEpoch; | 93 int get hashCode => millisecondsSinceEpoch; |
94 | 94 |
95 Date toLocal() { | 95 Date toLocal() { |
96 if (isUtc) { | 96 if (isUtc) { |
97 return new Date.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, | 97 return new Date.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, |
98 isUtc: false); | 98 isUtc: false); |
99 } | 99 } |
100 return this; | 100 return this; |
101 } | 101 } |
102 | 102 |
103 Date toUtc() { | 103 Date toUtc() { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 external Duration get timeZoneOffset; | 178 external Duration get timeZoneOffset; |
179 external int get year; | 179 external int get year; |
180 external int get month; | 180 external int get month; |
181 external int get day; | 181 external int get day; |
182 external int get hour; | 182 external int get hour; |
183 external int get minute; | 183 external int get minute; |
184 external int get second; | 184 external int get second; |
185 external int get millisecond; | 185 external int get millisecond; |
186 external int get weekday; | 186 external int get weekday; |
187 } | 187 } |
OLD | NEW |