Chromium Code Reviews| Index: sdk/lib/core/date_time.dart |
| diff --git a/sdk/lib/core/date_time.dart b/sdk/lib/core/date_time.dart |
| index 1e89080a5f688cb8219f982dbad99b719e5febd6..f01a4f2062a5294d52a600a46467396ec608e7a4 100644 |
| --- a/sdk/lib/core/date_time.dart |
| +++ b/sdk/lib/core/date_time.dart |
| @@ -367,6 +367,38 @@ class DateTime implements Comparable { |
| } |
| /** |
| + * Replaces specific parts of a date or time while keeping the rest. |
| + * |
| + * Equivalent to createing a new `DateTime` using `new DateTime` |
|
sra1
2015/11/23 21:15:14
creating
|
| + * with the values specified as arguments to this method, and taking |
| + * the values of the this `DateTime` object for arguments that were omitted. |
| + * |
| + * # Example |
| + * |
| + * var dt = new DateTime(1969, 7, 20, 20, 18); |
| + * var ut = dt.replace(day: 21, hour: 17, minute: 54); |
| + * Expect.equals("1969-07-21T17:54:00.000", "$ut"); |
| + * |
| + */ |
| + DateTime replace({int year, |
|
floitsch
2015/11/23 19:11:01
I think we discussed this already on another class
sra1
2015/11/23 21:15:14
I would like to see `with` too.
We should have us
|
| + int month, |
| + int day, |
| + int hour, |
| + int minute, |
| + int second, |
| + int millisecond, |
| + bool isUtc}) { |
| + return new DateTime._internal(year ?? this.year, |
| + month ?? this.month, |
| + day ?? this.day, |
| + hour ?? this.hour, |
| + minute ?? this.minute, |
| + second ?? this.second, |
| + millisecond ?? this.millisecond, |
| + isUtc ?? this.isUtc); |
| + } |
| + |
| + /** |
| * Returns true if [other] is a [DateTime] at the same moment and in the |
| * same time zone (UTC or local). |
| * |