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 // Dart core library. | 5 // Dart core library. |
6 | 6 |
7 /** | 7 /** |
8 * Date is the public interface to a point in time. | 8 * Date is the public interface to a point in time. |
9 * | 9 * |
10 * It can represent time values that are at a distance of at most | 10 * It can represent time values that are at a distance of at most |
11 * 8,640,000,000,000,000ms (100,000,000 days) from epoch (1970-01-01 UTC). In | 11 * 8,640,000,000,000,000ms (100,000,000 days) from epoch (1970-01-01 UTC). In |
12 * other words: [:millisecondsSinceEpoch.abs() <= 8640000000000000:]. | 12 * other words: [:millisecondsSinceEpoch.abs() <= 8640000000000000:]. |
13 * | 13 * |
14 * Also see [Stopwatch] for means to measure time-spans. | 14 * Also see [Stopwatch] for means to measure time-spans. |
15 */ | 15 */ |
16 interface Date extends Comparable, Hashable default DateImplementation { | 16 interface Date extends Comparable, Hashable default DateImplementation { |
17 // Weekday constants that are returned by [weekday] method: | 17 // Weekday constants that are returned by [weekday] method: |
18 static final int MON = 1; | 18 static const int MON = 1; |
19 static final int TUE = 2; | 19 static const int TUE = 2; |
20 static final int WED = 3; | 20 static const int WED = 3; |
21 static final int THU = 4; | 21 static const int THU = 4; |
22 static final int FRI = 5; | 22 static const int FRI = 5; |
23 static final int SAT = 6; | 23 static const int SAT = 6; |
24 static final int SUN = 7; | 24 static const int SUN = 7; |
25 static final int DAYS_IN_WEEK = 7; | 25 static const int DAYS_IN_WEEK = 7; |
26 | 26 |
27 // Month constants that are returned by the [month] getter. | 27 // Month constants that are returned by the [month] getter. |
28 static final int JAN = 1; | 28 static const int JAN = 1; |
29 static final int FEB = 2; | 29 static const int FEB = 2; |
30 static final int MAR = 3; | 30 static const int MAR = 3; |
31 static final int APR = 4; | 31 static const int APR = 4; |
32 static final int MAY = 5; | 32 static const int MAY = 5; |
33 static final int JUN = 6; | 33 static const int JUN = 6; |
34 static final int JUL = 7; | 34 static const int JUL = 7; |
35 static final int AUG = 8; | 35 static const int AUG = 8; |
36 static final int SEP = 9; | 36 static const int SEP = 9; |
37 static final int OCT = 10; | 37 static const int OCT = 10; |
38 static final int NOV = 11; | 38 static const int NOV = 11; |
39 static final int DEC = 12; | 39 static const int DEC = 12; |
40 | 40 |
41 /** | 41 /** |
42 * Constructs a [Date] instance based on the individual parts. The date is | 42 * Constructs a [Date] instance based on the individual parts. The date is |
43 * in the local time zone if [isUtc] is false. | 43 * in the local time zone if [isUtc] is false. |
44 * | 44 * |
45 * [month] and [day] are one-based. For example | 45 * [month] and [day] are one-based. For example |
46 * [:new Date(1938, 1, 10)] represents the 10th of January 1938. | 46 * [:new Date(1938, 1, 10)] represents the 10th of January 1938. |
47 */ | 47 */ |
48 // TODO(floitsch): the spec allows default values in interfaces, but our | 48 // TODO(floitsch): the spec allows default values in interfaces, but our |
49 // tools don't yet. Eventually we want to have default values here. | 49 // tools don't yet. Eventually we want to have default values here. |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 /** | 208 /** |
209 * Returns a new [Date] with the [duration] subtracted from this instance. | 209 * Returns a new [Date] with the [duration] subtracted from this instance. |
210 */ | 210 */ |
211 Date subtract(Duration duration); | 211 Date subtract(Duration duration); |
212 | 212 |
213 /** | 213 /** |
214 * Returns a [Duration] with the difference of [:this:] and [other]. | 214 * Returns a [Duration] with the difference of [:this:] and [other]. |
215 */ | 215 */ |
216 Duration difference(Date other); | 216 Duration difference(Date other); |
217 } | 217 } |
OLD | NEW |