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 /** | 7 /** |
8 * This is a private class internal to DateFormat which is used for formatting | 8 * This is a private class internal to DateFormat which is used for formatting |
9 * particular fields in a template. e.g. if the format is hh:mm:ss then the | 9 * particular fields in a template. e.g. if the format is hh:mm:ss then the |
10 * fields would be "hh", ":", "mm", ":", and "ss". Each type of field knows | 10 * fields would be "hh", ":", "mm", ":", and "ss". Each type of field knows |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 switch(width) { | 338 switch(width) { |
339 case 5: possibilities = symbols.STANDALONENARROWMONTHS; break; | 339 case 5: possibilities = symbols.STANDALONENARROWMONTHS; break; |
340 case 4: possibilities = symbols.STANDALONEMONTHS; break; | 340 case 4: possibilities = symbols.STANDALONEMONTHS; break; |
341 case 3: possibilities = symbols.STANDALONESHORTMONTHS; break; | 341 case 3: possibilities = symbols.STANDALONESHORTMONTHS; break; |
342 default: return handleNumericField(input, dateFields.setMonth); | 342 default: return handleNumericField(input, dateFields.setMonth); |
343 } | 343 } |
344 dateFields.month = parseEnumeratedString(input, possibilities) + 1; | 344 dateFields.month = parseEnumeratedString(input, possibilities) + 1; |
345 } | 345 } |
346 | 346 |
347 String formatQuarter(Date date) { | 347 String formatQuarter(Date date) { |
348 var quarter = (date.month / 3).truncate().toInt(); | 348 var quarter = (date.month / 3).truncate(); |
349 if (width < 4) { | 349 if (width < 4) { |
350 return symbols.SHORTQUARTERS[quarter]; | 350 return symbols.SHORTQUARTERS[quarter]; |
351 } else { | 351 } else { |
352 return symbols.QUARTERS[quarter]; | 352 return symbols.QUARTERS[quarter]; |
353 } | 353 } |
354 } | 354 } |
355 String formatDayOfMonth(Date date) { | 355 String formatDayOfMonth(Date date) { |
356 return padTo(width, date.day); | 356 return padTo(width, date.day); |
357 } | 357 } |
358 | 358 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 var basicString = toBePrinted.toString(); | 397 var basicString = toBePrinted.toString(); |
398 if (basicString.length >= width) return basicString; | 398 if (basicString.length >= width) return basicString; |
399 var buffer = new StringBuffer(); | 399 var buffer = new StringBuffer(); |
400 for (var i = 0; i < width - basicString.length; i++) { | 400 for (var i = 0; i < width - basicString.length; i++) { |
401 buffer.add('0'); | 401 buffer.add('0'); |
402 } | 402 } |
403 buffer.add(basicString); | 403 buffer.add(basicString); |
404 return buffer.toString(); | 404 return buffer.toString(); |
405 } | 405 } |
406 } | 406 } |
OLD | NEW |