| OLD | NEW |
| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // directly use the value and not the [_localDateInUtcValue]. | 68 // directly use the value and not the [_localDateInUtcValue]. |
| 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.THU - DateTime.MON) % DateTime.DAYS_IN_WEE
K) + | 78 return ((daysSince1970 + DateTime.THURSDAY - DateTime.MONDAY) |
| 79 DateTime.MON; | 79 % DateTime.DAYS_IN_WEEK) + |
| 80 DateTime.MONDAY; |
| 80 } | 81 } |
| 81 | 82 |
| 82 | 83 |
| 83 /** 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 |
| 84 * second list contains the days in leap years. */ | 85 * second list contains the days in leap years. */ |
| 85 static const List<List<int>> _DAYS_UNTIL_MONTH = | 86 static const List<List<int>> _DAYS_UNTIL_MONTH = |
| 86 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], |
| 87 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]]; |
| 88 | 89 |
| 89 // Returns the UTC year, month and day for the corresponding | 90 // Returns the UTC year, month and day for the corresponding |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 316 |
| 316 static String _timeZoneNameForClampedSeconds(int secondsSinceEpoch) | 317 static String _timeZoneNameForClampedSeconds(int secondsSinceEpoch) |
| 317 native "DateNatives_timeZoneName"; | 318 native "DateNatives_timeZoneName"; |
| 318 | 319 |
| 319 static int _timeZoneOffsetInSecondsForClampedSeconds(int secondsSinceEpoch) | 320 static int _timeZoneOffsetInSecondsForClampedSeconds(int secondsSinceEpoch) |
| 320 native "DateNatives_timeZoneOffsetInSeconds"; | 321 native "DateNatives_timeZoneOffsetInSeconds"; |
| 321 | 322 |
| 322 static int _localTimeZoneAdjustmentInSeconds() | 323 static int _localTimeZoneAdjustmentInSeconds() |
| 323 native "DateNatives_localTimeZoneAdjustmentInSeconds"; | 324 native "DateNatives_localTimeZoneAdjustmentInSeconds"; |
| 324 } | 325 } |
| OLD | NEW |