Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Unified Diff: sdk/lib/core/date_time.dart

Issue 2423993002: Emphasize that durations are context independent. (Closed)
Patch Set: More documentation. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/core/duration.dart » ('j') | sdk/lib/core/duration.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/date_time.dart
diff --git a/sdk/lib/core/date_time.dart b/sdk/lib/core/date_time.dart
index b792ac272e6a8bfb97fdf7acfff3ddb031fe9879..b4127392f483cf3983f43b4546d4c5e3fa5bbfb2 100644
--- a/sdk/lib/core/date_time.dart
+++ b/sdk/lib/core/date_time.dart
@@ -573,6 +573,13 @@ class DateTime implements Comparable<DateTime> {
*
* DateTime today = new DateTime.now();
* DateTime sixtyDaysFromNow = today.add(new Duration(days: 60));
+ *
+ * Notice that the duration being added is actually 60 * 24 * 60 * 60
Lasse Reichstein Nielsen 2016/10/17 12:40:12 Pick a number of days different from 60, it's conf
floitsch 2016/10/17 12:50:25 Done.
+ * seconds and if that crosses a daylight saving time change, the resulting
Lasse Reichstein Nielsen 2016/10/17 12:40:12 if that -> if this `DateTime` has non-UTC time zon
floitsch 2016/10/17 12:50:25 Done.
+ * `DateTime` won't have the same time of day as `today`, and may not even
+ * hit the calendar date 60 days later.
+ *
+ * Be careful when working with dates in local time.
*/
external DateTime add(Duration duration);
@@ -580,13 +587,14 @@ class DateTime implements Comparable<DateTime> {
* Returns a new [DateTime] instance with [duration] subtracted from [this].
*
* DateTime today = new DateTime.now();
- * DateTime sixtyDaysAgo = today.subtract(new Duration(days: 30));
+ * DateTime sixtyDaysAgo = today.subtract(new Duration(days: 60));
+ *
+ * Notice that the duration being subtracted is actually 60 * 24 * 60 * 60
Lasse Reichstein Nielsen 2016/10/17 12:40:12 same as above (except adding->subtracting).
floitsch 2016/10/17 12:50:25 Done.
+ * seconds and if that crosses a daylight saving time change, the resulting
+ * `DateTime` won't have the same time of day as `today`, and may not even
+ * hit the calendar date 60 days earlier.
*
- * Notice that duration being subtracted is actually 30 * 24 * 60 * 60 seconds
- * and if that crosses a daylight saving time change, the resulting `DateTime`
- * won't have the same time of day as `today`, and may not actually hit the
- * calendar date 30 days earlier. Be careful when working with dates in local
- * time.
+ * Be careful when working with dates in local time.
*/
external DateTime subtract(Duration duration);
« no previous file with comments | « no previous file | sdk/lib/core/duration.dart » ('j') | sdk/lib/core/duration.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698