Retry dates that come out with incorrect hours/days because of UTC offsets.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143586836
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3de399c..7b67fcc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
 ## 0.15.0
  * Fix compactCurrency to correctly use passed-in symbol.
+ * A tweak to the way we retry on DateTime.asDate to compensate for a VM bug.
 
 ## 0.14.0
  * MAJOR BREAKING CHANGE! Remove message extraction and code generation into a
diff --git a/lib/src/intl/date_format_helpers.dart b/lib/src/intl/date_format_helpers.dart
index 2b34e20..bc19716 100644
--- a/lib/src/intl/date_format_helpers.dart
+++ b/lib/src/intl/date_format_helpers.dart
@@ -81,7 +81,7 @@
 
   /// Return a date built using our values. If no date portion is set,
   /// use the "Epoch" of January 1, 1970.
-  DateTime asDate({retry: true}) {
+  DateTime asDate({int retries: 10}) {
     // TODO(alanknight): Validate the date, especially for things which
     // can crash the VM, e.g. large month values.
     var result;
@@ -91,11 +91,12 @@
     } else {
       result = new DateTime(
           year, month, day, hour24, minute, second, fractionalSecond);
-      // TODO(alanknight): Issue 15560 means non-UTC dates occasionally come
-      // out in UTC. If that happens, retry once. This will always happen if
-      // the local time zone is UTC, but that's ok.
-      if (result.toUtc() == result) {
-        result = asDate(retry: false);
+      // TODO(alanknight): Issue 15560 means non-UTC dates occasionally come out
+      // in UTC, or, alternatively, are constructed as if in UTC and then have
+      // the offset subtracted. If that happens, retry, several times if
+      // necessary.
+      if (retries > 0 && (result.hour != hour24 || result.day != day)) {
+        result = asDate(retries: retries - 1);
       }
     }
     return result;