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 | 4 |
5 /** | 5 /** |
6 * DateFormat is for formatting and parsing dates in a locale-sensitive | 6 * DateFormat is for formatting and parsing dates in a locale-sensitive |
7 * manner. | 7 * manner. |
8 * It allows the user to choose from a set of standard date time formats as well | 8 * It allows the user to choose from a set of standard date time formats as well |
9 * as specify a customized pattern under certain locales. Date elements that | 9 * as specify a customized pattern under certain locales. Date elements that |
10 * vary across locales include month name, week name, field order, etc. | 10 * vary across locales include month name, week name, field order, etc. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 * fails to parse "1234". In other words, the leftmost field of the run is | 158 * fails to parse "1234". In other words, the leftmost field of the run is |
159 * flexible, while the others keep a fixed width. If the parse fails anywhere in | 159 * flexible, while the others keep a fixed width. If the parse fails anywhere in |
160 * the run, then the leftmost field is shortened by one character, and the | 160 * the run, then the leftmost field is shortened by one character, and the |
161 * entire run is parsed again. This is repeated until either the parse succeeds | 161 * entire run is parsed again. This is repeated until either the parse succeeds |
162 * or the leftmost field is one character in length. If the parse still fails at | 162 * or the leftmost field is one character in length. If the parse still fails at |
163 * that point, the parse of the run fails. | 163 * that point, the parse of the run fails. |
164 */ | 164 */ |
165 | 165 |
166 #library('date_format'); | 166 #library('date_format'); |
167 | 167 |
| 168 #import('dart:math'); |
| 169 |
168 #import('intl.dart'); | 170 #import('intl.dart'); |
169 #import('date_time_patterns.dart'); | 171 #import('date_time_patterns.dart'); |
170 #import('date_symbols.dart'); | 172 #import('date_symbols.dart'); |
171 #import('date_symbol_data.dart'); | 173 #import('date_symbol_data.dart'); |
172 | 174 |
173 #source('lib/date_format_field.dart'); | 175 #source('lib/date_format_field.dart'); |
174 #source('lib/date_format_helpers.dart'); | 176 #source('lib/date_format_helpers.dart'); |
175 | 177 |
176 class DateFormat { | 178 class DateFormat { |
177 | 179 |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 /** Polyfill for missing library function. */ | 522 /** Polyfill for missing library function. */ |
521 List _reverse(List list) { | 523 List _reverse(List list) { |
522 // TODO(alanknight): Use standardized list reverse when implemented. | 524 // TODO(alanknight): Use standardized list reverse when implemented. |
523 // See Issue 2804. | 525 // See Issue 2804. |
524 var result = new List(); | 526 var result = new List(); |
525 for (var i = list.length-1; i >= 0; i--) { | 527 for (var i = list.length-1; i >= 0; i--) { |
526 result.addLast(list[i]); | 528 result.addLast(list[i]); |
527 } | 529 } |
528 return result; | 530 return result; |
529 } | 531 } |
530 } | 532 } |
OLD | NEW |