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

Side by Side Diff: runtime/lib/date_patch.dart

Issue 14065003: Rename DAYS_IN_WEEK to DAYS_PER_WEEK. Add MONTHS_PER_YEAR. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment. Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | samples/swarm/swarm_ui_lib/util/DateUtils.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // Dart core library. 4 // Dart core library.
5 5
6 // VM implementation of DateTime. 6 // VM implementation of DateTime.
7 patch class DateTime { 7 patch class DateTime {
8 /* patch */ DateTime._internal(int year, 8 /* patch */ DateTime._internal(int year,
9 int month, 9 int month,
10 int day, 10 int day,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 return millisecondsSinceEpoch % Duration.MILLISECONDS_PER_SECOND; 69 return millisecondsSinceEpoch % Duration.MILLISECONDS_PER_SECOND;
70 } 70 }
71 71
72 /** Returns the weekday of [this]. In accordance with ISO 8601 a week 72 /** Returns the weekday of [this]. In accordance with ISO 8601 a week
73 * starts with Monday. Monday has the value 1 up to Sunday with 7. */ 73 * starts with Monday. Monday has the value 1 up to Sunday with 7. */
74 /* patch */ int get weekday { 74 /* patch */ int get weekday {
75 int daysSince1970 = 75 int daysSince1970 =
76 _flooredDivision(_localDateInUtcMs, Duration.MILLISECONDS_PER_DAY); 76 _flooredDivision(_localDateInUtcMs, Duration.MILLISECONDS_PER_DAY);
77 // 1970-1-1 was a Thursday. 77 // 1970-1-1 was a Thursday.
78 return ((daysSince1970 + DateTime.THURSDAY - DateTime.MONDAY) 78 return ((daysSince1970 + DateTime.THURSDAY - DateTime.MONDAY)
79 % DateTime.DAYS_IN_WEEK) + 79 % DateTime.DAYS_PER_WEEK) +
80 DateTime.MONDAY; 80 DateTime.MONDAY;
81 } 81 }
82 82
83 83
84 /** The first list contains the days until each month in non-leap years. The 84 /** The first list contains the days until each month in non-leap years. The
85 * second list contains the days in leap years. */ 85 * second list contains the days in leap years. */
86 static const List<List<int>> _DAYS_UNTIL_MONTH = 86 static const List<List<int>> _DAYS_UNTIL_MONTH =
87 const [const [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], 87 const [const [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
88 const [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]]; 88 const [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]];
89 89
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 316
317 static String _timeZoneNameForClampedSeconds(int secondsSinceEpoch) 317 static String _timeZoneNameForClampedSeconds(int secondsSinceEpoch)
318 native "DateNatives_timeZoneName"; 318 native "DateNatives_timeZoneName";
319 319
320 static int _timeZoneOffsetInSecondsForClampedSeconds(int secondsSinceEpoch) 320 static int _timeZoneOffsetInSecondsForClampedSeconds(int secondsSinceEpoch)
321 native "DateNatives_timeZoneOffsetInSeconds"; 321 native "DateNatives_timeZoneOffsetInSeconds";
322 322
323 static int _localTimeZoneAdjustmentInSeconds() 323 static int _localTimeZoneAdjustmentInSeconds()
324 native "DateNatives_localTimeZoneAdjustmentInSeconds"; 324 native "DateNatives_localTimeZoneAdjustmentInSeconds";
325 } 325 }
OLDNEW
« no previous file with comments | « no previous file | samples/swarm/swarm_ui_lib/util/DateUtils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698