| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 * strings consisting of exactly two digits, as defined by {@link | 148 * strings consisting of exactly two digits, as defined by {@link |
| 149 * java.lang.Character#isDigit(char)}, will be parsed into the default | 149 * java.lang.Character#isDigit(char)}, will be parsed into the default |
| 150 * century. Any other numeric string, such as a one digit string, a three or | 150 * century. Any other numeric string, such as a one digit string, a three or |
| 151 * more digit string will be interpreted as its face value. | 151 * more digit string will be interpreted as its face value. |
| 152 * | 152 * |
| 153 * If the year pattern does not have exactly two 'y' characters, the year is | 153 * If the year pattern does not have exactly two 'y' characters, the year is |
| 154 * interpreted literally, regardless of the number of digits. So using the | 154 * interpreted literally, regardless of the number of digits. So using the |
| 155 * pattern "MM/dd/yyyy", "01/11/12" parses to Jan 11, 12 A.D. | 155 * pattern "MM/dd/yyyy", "01/11/12" parses to Jan 11, 12 A.D. |
| 156 */ | 156 */ |
| 157 | 157 |
| 158 #library('date_format'); | |
| 159 | |
| 160 #import('dart:math'); | |
| 161 #import('intl.dart'); | |
| 162 #import('date_symbols.dart'); | |
| 163 #import('src/intl_helpers.dart'); | |
| 164 #import('src/date_format_internal.dart'); | |
| 165 | |
| 166 #source('src/date_format_field.dart'); | |
| 167 #source('src/date_format_helpers.dart'); | |
| 168 | |
| 169 class DateFormat { | 158 class DateFormat { |
| 170 | 159 |
| 171 /** | 160 /** |
| 172 * Creates a new DateFormat, using the format specified by [newPattern]. For | 161 * Creates a new DateFormat, using the format specified by [newPattern]. For |
| 173 * forms that match one of our predefined skeletons, we look up the | 162 * forms that match one of our predefined skeletons, we look up the |
| 174 * corresponding pattern in [locale] (or in the default locale if none is | 163 * corresponding pattern in [locale] (or in the default locale if none is |
| 175 * specified) and use the resulting full format string. This is the | 164 * specified) and use the resulting full format string. This is the |
| 176 * preferred usage, but if [newPattern] does not match one of the skeletons, | 165 * preferred usage, but if [newPattern] does not match one of the skeletons, |
| 177 * then it is used as a format directly, but will not be adapted to suit | 166 * then it is used as a format directly, but will not be adapted to suit |
| 178 * the locale. | 167 * the locale. |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 List _reverse(List list) { | 551 List _reverse(List list) { |
| 563 // TODO(alanknight): Use standardized list reverse when implemented. | 552 // TODO(alanknight): Use standardized list reverse when implemented. |
| 564 // See Issue 2804. | 553 // See Issue 2804. |
| 565 var result = new List(); | 554 var result = new List(); |
| 566 for (var i = list.length-1; i >= 0; i--) { | 555 for (var i = list.length-1; i >= 0; i--) { |
| 567 result.addLast(list[i]); | 556 result.addLast(list[i]); |
| 568 } | 557 } |
| 569 return result; | 558 return result; |
| 570 } | 559 } |
| 571 } | 560 } |
| OLD | NEW |