| Index: pkg/intl/lib/date_format.dart
|
| ===================================================================
|
| --- pkg/intl/lib/date_format.dart (revision 13269)
|
| +++ pkg/intl/lib/date_format.dart (working copy)
|
| @@ -426,12 +426,22 @@
|
| */
|
| get _formatFields {
|
| if (_formatFieldsPrivate == null) {
|
| + if (_pattern == null) _useDefaultPattern();
|
| _formatFieldsPrivate = parsePattern(_pattern);
|
| }
|
| return _formatFieldsPrivate;
|
| }
|
|
|
| /**
|
| + * We are being asked to do formatting without having set any pattern.
|
| + * Use a default.
|
| + */
|
| + _useDefaultPattern() {
|
| + add_yMMMMd();
|
| + add_jms();
|
| + }
|
| +
|
| + /**
|
| * A series of regular expressions used to parse a format string into its
|
| * component fields.
|
| */
|
| @@ -454,7 +464,7 @@
|
| * Set our pattern, appending it to any existing patterns. Also adds a single
|
| * space to separate the two.
|
| */
|
| - _setPattern(String inputPattern, [String separator = ' ']) {
|
| + _appendPattern(String inputPattern, [String separator = ' ']) {
|
| if (_pattern == null) {
|
| _pattern = inputPattern;
|
| } else {
|
| @@ -473,13 +483,14 @@
|
| // TODO(alanknight): This is an expensive operation. Caching recently used
|
| // formats, or possibly introducing an entire "locale" object that would
|
| // cache patterns for that locale could be a good optimization.
|
| + // If we have already parsed the format fields, reset them.
|
| + _formatFieldsPrivate = null;
|
| + if (inputPattern == null) return this;
|
| if (!_availableSkeletons.containsKey(inputPattern)) {
|
| - _setPattern(inputPattern, separator);
|
| + _appendPattern(inputPattern, separator);
|
| } else {
|
| - _setPattern(_availableSkeletons[inputPattern], separator);
|
| + _appendPattern(_availableSkeletons[inputPattern], separator);
|
| }
|
| - // If we have already parsed the format fields, reset them.
|
| - _formatFieldsPrivate = null;
|
| return this;
|
| }
|
|
|
|
|