Chromium Code Reviews| Index: corelib/src/date.dart |
| diff --git a/corelib/src/date.dart b/corelib/src/date.dart |
| index 809530ef59d34329111ded6921a2eac956fd944e..0b1b5781ea5c2e24ac1264f34c5eda5a33146ce0 100644 |
| --- a/corelib/src/date.dart |
| +++ b/corelib/src/date.dart |
| @@ -33,8 +33,8 @@ interface Date extends Comparable, Hashable default DateImplementation { |
| static final int DEC = 12; |
| /** |
| - * Constructs a [Date] instance based on the individual parts, in the |
| - * local time-zone. |
| + * Constructs a [Date] instance based on the individual parts. The date is |
| + * in the local time-zone if [isUtc] is false. |
| */ |
| // TODO(floitsch): the spec allows default values in interfaces, but our |
| // tools don't yet. Eventually we want to have default values here. |
| @@ -44,11 +44,14 @@ interface Date extends Comparable, Hashable default DateImplementation { |
| int hours, |
| int minutes, |
| int seconds, |
| - int milliseconds]); |
| + int milliseconds, |
| + bool isUtc]); |
| /** |
| * Constructs a [Date] instance based on the individual parts. |
| * [timeZone] may not be [:null:]. |
| + * |
| + * *DEPRECATED* |
| */ |
| Date.withTimeZone(int year, |
| int month, |
| @@ -71,44 +74,62 @@ interface Date extends Comparable, Hashable default DateImplementation { |
| Date.fromString(String formattedString); |
| /** |
| - * Constructs a new [Date] instance with the given time zone. The given |
| - * [timeZone] must not be [:null:]. |
| - * |
| - * This constructor is the only one that doesn't need to be computations and |
| - * which can therefore be [:const:]. |
| + * Constructs a new [Date] instance with the given [value]. If [isUtc] is |
| + * false then the date is in the local time-zone. |
| * |
| * The constructed [Date] represents 1970-01-01T00:00:00Z + [value]ms in |
| * the given [timeZone]. |
|
ngeoffray
2012/05/22 08:58:45
Update comment
floitsch
2012/05/22 14:50:38
Done.
|
| */ |
| - const Date.fromEpoch(int value, TimeZone timeZone); |
| + Date.fromEpoch(int value, [bool isUtc]); |
| /** |
| + * Returns true if [this] occurs at the same time as [other]. The |
| + * comparison is independent of the time zone the [Date] is in. |
|
ngeoffray
2012/05/22 08:58:45
of whether the time is utc or in the local time zo
floitsch
2012/05/22 14:50:38
Done.
|
| + */ |
| + bool operator ==(Date other); |
| + /** |
| * Returns true if [this] occurs before [other]. The comparison is independent |
| - * of the timezone the [Date] is in. |
| + * of the time zone the [Date] is in. |
| */ |
| bool operator <(Date other); |
| /** |
| * Returns true if [this] occurs at the same time or before [other]. The |
| - * comparison is independent of the timezone the [Date] is in. |
| + * comparison is independent of the time zone the [Date] is in. |
| */ |
| bool operator <=(Date other); |
| /** |
| * Returns true if [this] occurs after [other]. The comparison is independent |
| - * of the timezone the [Date] is in. |
| + * of the time zone the [Date] is in. |
| */ |
| bool operator >(Date other); |
| /** |
| * Returns true if [this] occurs at the same time or after [other]. The |
| - * comparison is independent of the timezone the [Date] is in. |
| + * comparison is independent of the time zone the [Date] is in. |
| */ |
| bool operator >=(Date other); |
| + |
| + /** |
| + * Returns [this] in the local time-zone. Returns itself if it is already in |
| + * the local time zone. Otherwise, this method is equvalent to |
|
ngeoffray
2012/05/22 08:58:45
equivalent
floitsch
2012/05/22 14:50:38
Done.
|
| + * [:new Date.fromEpoch(this.value, isUtc: false):]. |
| + */ |
| + Date toLocal(); |
| + |
| + /** |
| + * Returns [this] in UTC. Returns itself it is already in UTC. Otherwise, this |
|
ngeoffray
2012/05/22 08:58:45
itself *if* it is
floitsch
2012/05/22 14:50:38
Done.
|
| + * method is equvalent to [:new Date.fromEpoch(this.value, isUtc: true):]. |
|
ngeoffray
2012/05/22 08:58:45
equivalent
floitsch
2012/05/22 14:50:38
Done.
|
| + */ |
| + Date toUtc(); |
| + |
| /** |
| * Returns a new [Date] in the given [targetTimeZone] time zone. The |
| * [value] of the new instance is equal to [:this.value:]. |
| * |
| * This call is equivalent to |
| * [:new Date.fromEpoch(this.value, targetTimeZone):]. |
| + * |
| + * *DEPRECATED* |
| */ |
| Date changeTimeZone(TimeZone targetTimeZone); |
| @@ -178,17 +199,13 @@ interface Date extends Comparable, Hashable default DateImplementation { |
| /** |
| * Returns the timeZone of this instance. |
| + * |
| + * *DEPRECATED*. |
| */ |
| final TimeZone timeZone; |
| /** |
| - * Returns true if this [Date] is set to local time. |
| - */ |
| - bool isLocalTime(); |
| - |
| - /** |
| * Returns true if this [Date] is set to UTC time. |
| - * This is equivalent to [:this.timeZone.isUtc():]. |
| */ |
| bool isUtc(); |