Chromium Code Reviews| Index: lib/core/date.dart |
| =================================================================== |
| --- lib/core/date.dart (revision 13588) |
| +++ lib/core/date.dart (working copy) |
| @@ -40,7 +40,7 @@ |
| /** |
| * Constructs a [Date] instance based on the individual parts. The date is |
| - * in the local time zone if [isUtc] is false. |
| + * in the local time zone. |
| * |
| * [month] and [day] are one-based. For example |
| * [:new Date(1938, 1, 10)] represents the 10th of January 1938. |
|
Lasse Reichstein Nielsen
2012/10/12 07:52:19
Missing ':' before ']'.
regis
2012/10/12 17:51:51
Done here and below.
|
| @@ -51,14 +51,33 @@ |
| int hour = 0, |
| int minute = 0, |
| int second = 0, |
| - int millisecond = 0, |
| - bool isUtc = false]) { |
| + int millisecond = 0]) { |
| return new DateImplementation(year, month, day, |
| hour, minute, second, |
| - millisecond, isUtc); |
| + millisecond, false); |
| } |
| /** |
| + * Constructs a [Date] instance based on the individual parts. The date is |
| + * in the UTC time zone. |
| + * |
| + * [month] and [day] are one-based. For example |
| + * [:new Date.utc(1938, 1, 10)] represents the 10th of January 1938 in |
| + * Coordinated Universal Time. |
| + */ |
| + factory Date.utc(int year, |
| + [int month = 1, |
| + int day = 1, |
| + int hour = 0, |
| + int minute = 0, |
| + int second = 0, |
| + int millisecond = 0]) { |
| + return new DateImplementation(year, month, day, |
| + hour, minute, second, |
| + millisecond, true); |
|
Lasse Reichstein Nielsen
2012/10/12 07:52:19
Much, much better. Thanks :)
|
| + } |
| + |
| + /** |
| * Constructs a new [Date] instance with current date time value in the |
| * local time zone. |
| */ |
| @@ -82,7 +101,7 @@ |
| // tools don't yet. Eventually we want to have default values here. |
| // TODO(lrn): Have two constructors instead of taking an optional bool. |
| factory Date.fromMillisecondsSinceEpoch(int millisecondsSinceEpoch, |
| - [bool isUtc = false]) { |
| + {bool isUtc: false}) { |
| return new DateImplementation.fromMillisecondsSinceEpoch( |
| millisecondsSinceEpoch, isUtc); |
| } |
| @@ -120,14 +139,16 @@ |
| /** |
| * Returns [this] in the local time zone. Returns itself if it is already in |
| * the local time zone. Otherwise, this method is equivalent to |
| - * [:new Date.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, false):]. |
| + * [:new Date.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, |
| + * isUtc: false):]. |
| */ |
| Date toLocal(); |
| /** |
| * Returns [this] in UTC. Returns itself if it is already in UTC. Otherwise, |
| * this method is equivalent to |
| - * [:new Date.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, true):]. |
| + * [:new Date.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, |
| + * isUtc: true):]. |
| */ |
| Date toUtc(); |