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

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

Issue 2423993002: Emphasize that durations are context independent. (Closed)
Patch Set: Address comments. 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') | no next file with comments »
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..0453704e1d2cfeb5915305ce59ab4a4b6da9b445 100644
--- a/sdk/lib/core/date_time.dart
+++ b/sdk/lib/core/date_time.dart
@@ -572,7 +572,14 @@ class DateTime implements Comparable<DateTime> {
* Returns a new [DateTime] instance with [duration] added to [this].
*
* DateTime today = new DateTime.now();
- * DateTime sixtyDaysFromNow = today.add(new Duration(days: 60));
+ * DateTime fiftyDaysFromNow = today.add(new Duration(days: 50));
+ *
+ * Notice that the duration being added is actually 50 * 24 * 60 * 60
+ * seconds. If the resulting `DateTime` has a different daylight saving offset
+ * than `this`, then the result won't have the same time-of-day as `this`, and
+ * may not even hit the calendar date 50 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 fiftyDaysAgo = today.subtract(new Duration(days: 50));
+ *
+ * Notice that the duration being subtracted is actually 50 * 24 * 60 * 60
+ * seconds. If the resulting `DateTime` has a different daylight saving offset
+ * than `this`, then the result won't have the same time-of-day as `this`, and
+ * may not even hit the calendar date 50 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698