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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 * | 175 * |
176 * For example, in an en_US locale, specifying the skeleton | 176 * For example, in an en_US locale, specifying the skeleton |
177 * `new DateFormat('yMEd');` | 177 * `new DateFormat('yMEd');` |
178 * or the explicit | 178 * or the explicit |
179 * `new DateFormat('EEE, M/d/y');` | 179 * `new DateFormat('EEE, M/d/y');` |
180 * would produce the same result, a date of the form | 180 * would produce the same result, a date of the form |
181 * `Wed, 6/27/2012` | 181 * `Wed, 6/27/2012` |
182 * However, the skeleton version would also adapt to other locales. | 182 * However, the skeleton version would also adapt to other locales. |
183 * | 183 * |
184 * If [locale] does not exist in our set of supported locales then an | 184 * If [locale] does not exist in our set of supported locales then an |
185 * [IllegalArgumentException] is thrown. | 185 * [ArgumentError] is thrown. |
186 */ | 186 */ |
187 DateFormat([String newPattern, String locale]) { | 187 DateFormat([String newPattern, String locale]) { |
188 // TODO(alanknight): It should be possible to specify multiple skeletons eg | 188 // TODO(alanknight): It should be possible to specify multiple skeletons eg |
189 // date, time, timezone all separately. Adding many or named parameters to | 189 // date, time, timezone all separately. Adding many or named parameters to |
190 // the constructor seems awkward, especially with the possibility of | 190 // the constructor seems awkward, especially with the possibility of |
191 // confusion with the locale. A "fluent" interface with cascading on an | 191 // confusion with the locale. A "fluent" interface with cascading on an |
192 // instance might work better? A list of patterns is also possible. | 192 // instance might work better? A list of patterns is also possible. |
193 // TODO(alanknight): There will need to be at least setup type async | 193 // TODO(alanknight): There will need to be at least setup type async |
194 // operations to avoid the need to bring along every locale in every program | 194 // operations to avoid the need to bring along every locale in every program |
195 _locale = Intl.verifiedLocale(locale); | 195 _locale = Intl.verifiedLocale(locale); |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 List _reverse(List list) { | 547 List _reverse(List list) { |
548 // TODO(alanknight): Use standardized list reverse when implemented. | 548 // TODO(alanknight): Use standardized list reverse when implemented. |
549 // See Issue 2804. | 549 // See Issue 2804. |
550 var result = new List(); | 550 var result = new List(); |
551 for (var i = list.length-1; i >= 0; i--) { | 551 for (var i = list.length-1; i >= 0; i--) { |
552 result.addLast(list[i]); | 552 result.addLast(list[i]); |
553 } | 553 } |
554 return result; | 554 return result; |
555 } | 555 } |
556 } | 556 } |
OLD | NEW |