Add support for "Q" and "QQ" numeric quarter formatting.

"Q" appears in the zh_CN locale data.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130409213
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f4489f3..a33e824 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,8 @@
  * Fixed the use of currency-specific decimal places, which weren't being used
    if the currency was the default for the locale.
  * Add support for currency in compact number formats.
+ * Added support for "Q" and "QQ" numeric quarter formatting, which fixes "QQQ"
+   and "QQQQ" in the zh_CN locale.
 
 ## 0.13.0
  * Add support for compact number formats ("1.2K") and for significant digits in
diff --git a/lib/src/intl/date_format_field.dart b/lib/src/intl/date_format_field.dart
index 1211d39..3c70d99 100644
--- a/lib/src/intl/date_format_field.dart
+++ b/lib/src/intl/date_format_field.dart
@@ -562,10 +562,13 @@
 
   String formatQuarter(DateTime date) {
     var quarter = ((date.month - 1) / 3).truncate();
-    if (width < 4) {
-      return symbols.SHORTQUARTERS[quarter];
-    } else {
-      return symbols.QUARTERS[quarter];
+    switch (width) {
+      case 4:
+        return symbols.QUARTERS[quarter];
+      case 3:
+        return symbols.SHORTQUARTERS[quarter];
+      default:
+        return padTo(width, quarter + 1);
     }
   }
 
diff --git a/test/date_time_format_test_core.dart b/test/date_time_format_test_core.dart
index 068ceeb..4201912 100644
--- a/test/date_time_format_test_core.dart
+++ b/test/date_time_format_test_core.dart
@@ -361,17 +361,40 @@
     }
   });
 
+  test('Quarter formatting', () {
+    var date = new DateTime(2012, 02, 27);
+    var formats = {
+      'Q': '1',
+      'QQ': '01',
+      'QQQ': 'Q1',
+      'QQQQ': '1st quarter',
+      'QQQQQ': '00001'
+    };
+    formats.forEach((pattern, result) {
+      expect(new DateFormat(pattern, 'en_US').format(date), result);
+    });
+
+    if (subset.contains('zh_CN')) {
+      // Especially test zh_CN formatting for `QQQ` and `yQQQ` because it
+      // contains a single `Q`.
+      expect(new DateFormat.QQQ('zh_CN').format(date), '1季度');
+      expect(new DateFormat.yQQQ('zh_CN').format(date), '2012年第1季度');
+    }
+  });
+
   /// Generate a map from day numbers in the given [year] (where Jan 1 == 1)
   /// to a Date object. If [year] is a leap year, then pass 1 for
   /// [leapDay], otherwise pass 0.
   Map<int, DateTime> generateDates(int year, int leapDay) =>
       new Iterable.generate(365 + leapDay, (n) => n + 1)
-          .map /*<DateTime>*/ ((day) {
-        var result = new DateTime(year, 1, day);
-        // TODO(alanknight): This is a workaround for dartbug.com/15560.
-        if (result.toUtc() == result) result = new DateTime(year, 1, day);
-        return result;
-      }).toList().asMap();
+          .map/*<DateTime>*/((day) {
+            var result = new DateTime(year, 1, day);
+            // TODO(alanknight): This is a workaround for dartbug.com/15560.
+            if (result.toUtc() == result) result = new DateTime(year, 1, day);
+            return result;
+          })
+          .toList()
+          .asMap();
 
   void verifyOrdinals(Map dates) {
     var f = new DateFormat("D");