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

Unified Diff: packages/quiver/lib/src/time/clock.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 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 | « packages/quiver/lib/src/streams/streambuffer.dart ('k') | packages/quiver/lib/streams.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/quiver/lib/src/time/clock.dart
diff --git a/packages/quiver/lib/src/time/clock.dart b/packages/quiver/lib/src/time/clock.dart
index dcc8a2c10a75d383c0be88ac3d3e2ab6c2536c73..f9879be2ecc152c2efc6c0753d614fe148e0d166 100644
--- a/packages/quiver/lib/src/time/clock.dart
+++ b/packages/quiver/lib/src/time/clock.dart
@@ -22,11 +22,26 @@ DateTime systemTime() => new DateTime.now();
/// Days in a month. This array uses 1-based month numbers, i.e. January is
/// the 1-st element in the array, not the 0-th.
-const _DAYS_IN_MONTH =
- const [ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
-
-int _daysInMonth(int year, int month) => (month == DateTime.FEBRUARY &&
- _isLeapYear(year)) ? 29 : _DAYS_IN_MONTH[month];
+const _DAYS_IN_MONTH = const [
+ 0,
+ 31,
+ 28,
+ 31,
+ 30,
+ 31,
+ 30,
+ 31,
+ 31,
+ 30,
+ 31,
+ 30,
+ 31
+];
+
+int _daysInMonth(int year, int month) =>
+ (month == DateTime.FEBRUARY && _isLeapYear(year))
+ ? 29
+ : _DAYS_IN_MONTH[month];
bool _isLeapYear(int year) =>
(year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0));
@@ -83,8 +98,14 @@ class Clock {
/// Returns the point in time that's given amount of time ago. The
/// amount of time is the sum of individual parts. Parts are compatible with
/// ones defined in [Duration].
- DateTime ago({int days: 0, int hours: 0, int minutes: 0, int seconds: 0,
- int milliseconds: 0, int microseconds: 0}) => agoBy(new Duration(
+ DateTime ago(
+ {int days: 0,
+ int hours: 0,
+ int minutes: 0,
+ int seconds: 0,
+ int milliseconds: 0,
+ int microseconds: 0}) =>
+ agoBy(new Duration(
days: days,
hours: hours,
minutes: minutes,
@@ -95,8 +116,14 @@ class Clock {
/// Returns the point in time that's given amount of time from now. The
/// amount of time is the sum of individual parts. Parts are compatible with
/// ones defined in [Duration].
- DateTime fromNow({int days: 0, int hours: 0, int minutes: 0, int seconds: 0,
- int milliseconds: 0, int microseconds: 0}) => fromNowBy(new Duration(
+ DateTime fromNow(
+ {int days: 0,
+ int hours: 0,
+ int minutes: 0,
+ int seconds: 0,
+ int milliseconds: 0,
+ int microseconds: 0}) =>
+ fromNowBy(new Duration(
days: days,
hours: hours,
minutes: minutes,
« no previous file with comments | « packages/quiver/lib/src/streams/streambuffer.dart ('k') | packages/quiver/lib/streams.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698