Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: pkg/intl/lib/date_format.dart

Issue 24156005: Support "D" for ordinal date in Intl.DateFormat (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes from review Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/intl/lib/src/date_format_field.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 */ 479 */
480 static List<RegExp> _matchers = [ 480 static List<RegExp> _matchers = [
481 // Quoted String - anything between single quotes, with escaping 481 // Quoted String - anything between single quotes, with escaping
482 // of single quotes by doubling them. 482 // of single quotes by doubling them.
483 // e.g. in the pattern "hh 'o''clock'" will match 'o''clock' 483 // e.g. in the pattern "hh 'o''clock'" will match 'o''clock'
484 new RegExp("^\'(?:[^\']|\'\')*\'"), 484 new RegExp("^\'(?:[^\']|\'\')*\'"),
485 // Fields - any sequence of 1 or more of the same field characters. 485 // Fields - any sequence of 1 or more of the same field characters.
486 // e.g. in "hh:mm:ss" will match hh, mm, and ss. But in "hms" would 486 // e.g. in "hh:mm:ss" will match hh, mm, and ss. But in "hms" would
487 // match each letter individually. 487 // match each letter individually.
488 new RegExp( 488 new RegExp(
489 "^(?:G+|y+|M+|k+|S+|E+|a+|h+|K+|H+|c+|L+|Q+|d+|m+|s+|v+|z+|Z+)"), 489 "^(?:G+|y+|M+|k+|S+|E+|a+|h+|K+|H+|c+|L+|Q+|d+|D+|m+|s+|v+|z+|Z+)"),
490 // Everything else - A sequence that is not quotes or field characters. 490 // Everything else - A sequence that is not quotes or field characters.
491 // e.g. in "hh:mm:ss" will match the colons. 491 // e.g. in "hh:mm:ss" will match the colons.
492 new RegExp("^[^\'GyMkSEahKHcLQdmsvzZ]+") 492 new RegExp("^[^\'GyMkSEahKHcLQdDmsvzZ]+")
493 ]; 493 ];
494 494
495 /** 495 /**
496 * Set our pattern, appending it to any existing patterns. Also adds a single 496 * Set our pattern, appending it to any existing patterns. Also adds a single
497 * space to separate the two. 497 * space to separate the two.
498 */ 498 */
499 _appendPattern(String inputPattern, [String separator = ' ']) { 499 _appendPattern(String inputPattern, [String separator = ' ']) {
500 if (_pattern == null) { 500 if (_pattern == null) {
501 _pattern = inputPattern; 501 _pattern = inputPattern;
502 } else { 502 } else {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 _DateFormatField _match(String pattern) { 591 _DateFormatField _match(String pattern) {
592 for (var i = 0; i < _matchers.length; i++) { 592 for (var i = 0; i < _matchers.length; i++) {
593 var regex = _matchers[i]; 593 var regex = _matchers[i];
594 var match = regex.firstMatch(pattern); 594 var match = regex.firstMatch(pattern);
595 if (match != null) { 595 if (match != null) {
596 return _fieldConstructors[i](match.group(0), this); 596 return _fieldConstructors[i](match.group(0), this);
597 } 597 }
598 } 598 }
599 } 599 }
600 } 600 }
OLDNEW
« no previous file with comments | « no previous file | pkg/intl/lib/src/date_format_field.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698