| 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 part of intl; | 5 part of intl; |
| 6 | 6 |
| 7 // TODO(efortuna): Customized pattern system -- suggested by i18n needs | 7 // TODO(efortuna): Customized pattern system -- suggested by i18n needs |
| 8 // feedback on appropriateness. | 8 // feedback on appropriateness. |
| 9 /** | 9 /** |
| 10 * DateFormat is for formatting and parsing dates in a locale-sensitive | 10 * DateFormat is for formatting and parsing dates in a locale-sensitive |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 addPattern(newPattern); | 218 addPattern(newPattern); |
| 219 } | 219 } |
| 220 | 220 |
| 221 /** | 221 /** |
| 222 * Return a string representing [date] formatted according to our locale | 222 * Return a string representing [date] formatted according to our locale |
| 223 * and internal format. | 223 * and internal format. |
| 224 */ | 224 */ |
| 225 String format(DateTime date) { | 225 String format(DateTime date) { |
| 226 // TODO(efortuna): read optional TimeZone argument (or similar)? | 226 // TODO(efortuna): read optional TimeZone argument (or similar)? |
| 227 var result = new StringBuffer(); | 227 var result = new StringBuffer(); |
| 228 _formatFields.forEach((field) => result.add(field.format(date))); | 228 _formatFields.forEach((field) => result.write(field.format(date))); |
| 229 return result.toString(); | 229 return result.toString(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 /** | 232 /** |
| 233 * Returns a date string indicating how long ago (3 hours, 2 minutes) | 233 * Returns a date string indicating how long ago (3 hours, 2 minutes) |
| 234 * something has happened or how long in the future something will happen | 234 * something has happened or how long in the future something will happen |
| 235 * given a [reference] DateTime relative to the current time. | 235 * given a [reference] DateTime relative to the current time. |
| 236 */ | 236 */ |
| 237 String formatDuration(DateTime reference) { | 237 String formatDuration(DateTime reference) { |
| 238 return ''; | 238 return ''; |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 List _reverse(List list) { | 589 List _reverse(List list) { |
| 590 // TODO(alanknight): Use standardized list reverse when implemented. | 590 // TODO(alanknight): Use standardized list reverse when implemented. |
| 591 // See Issue 2804. | 591 // See Issue 2804. |
| 592 var result = new List(); | 592 var result = new List(); |
| 593 for (var i = list.length-1; i >= 0; i--) { | 593 for (var i = list.length-1; i >= 0; i--) { |
| 594 result.addLast(list[i]); | 594 result.addLast(list[i]); |
| 595 } | 595 } |
| 596 return result; | 596 return result; |
| 597 } | 597 } |
| 598 } | 598 } |
| OLD | NEW |