OLD | NEW |
1 part of utilslib; | |
2 | |
3 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
4 // 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 |
5 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
6 | 4 |
7 /** | 5 /** |
8 * General purpose date/time utilities. | 6 * General purpose date/time utilities. |
9 */ | 7 */ |
10 class DateUtils { | 8 class DateUtils { |
11 // TODO(jmesserly): localized strings | 9 // TODO(jmesserly): localized strings |
12 static const WEEKDAYS = const ['Monday', 'Tuesday', 'Wednesday', 'Thursday', | 10 static const WEEKDAYS = const ['Monday', 'Tuesday', 'Wednesday', 'Thursday', |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 176 } |
179 String twoDigits(int n) { | 177 String twoDigits(int n) { |
180 if (n >= 10) return "${n}"; | 178 if (n >= 10) return "${n}"; |
181 return "0${n}"; | 179 return "0${n}"; |
182 } | 180 } |
183 String mm = | 181 String mm = |
184 twoDigits(duration.inMinutes.remainder(Duration.MINUTES_PER_HOUR)); | 182 twoDigits(duration.inMinutes.remainder(Duration.MINUTES_PER_HOUR)); |
185 return "${hours}:${mm} ${a}"; | 183 return "${hours}:${mm} ${a}"; |
186 } | 184 } |
187 } | 185 } |
OLD | NEW |