RelativeDateFormatter: Fix bad rounding of "1 year 12 months" to "2 year"

Change I8b1af0e72 fixed rounding of dates, but it only works properly
when the year is already greater than 1.

In the case "1 year 12 months", the year is correctly incremented to 2,
but the label is not adjusted, resulting in "2 year".

This was not noticed during review of I8b1af0e72 because the test that
was added only tests for "4 years 12 months" being rounded to "5 years".

Add an adjustment of the label when the year count is incremented, and
add a test for "1 year 12 months" being correctly rounded to "2 years".

The test is taken from [1] on the jgit project.

[1] https://git.eclipse.org/r/#/c/109895/

Bug: Issue 7357
Change-Id: I9729e6ad82ad31f36d889f59a6663c7c05495b73
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/RelativeDateFormatter.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/RelativeDateFormatter.java
index a0c4aa6..fdd6454 100644
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/RelativeDateFormatter.java
+++ b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/RelativeDateFormatter.java
@@ -123,6 +123,9 @@
       }
       if (months == 12) {
         years++;
+        if (years > 1) {
+          yearLabel = c().years();
+        }
         return m().years0MonthsAgo(years, yearLabel);
       }
       return m().yearsMonthsAgo(years, yearLabel, months, monthLabel);
diff --git a/gerrit-gwtui-common/src/test/java/com/google/gerrit/client/RelativeDateFormatterTest.java b/gerrit-gwtui-common/src/test/java/com/google/gerrit/client/RelativeDateFormatterTest.java
index 5180410..6915ba7 100644
--- a/gerrit-gwtui-common/src/test/java/com/google/gerrit/client/RelativeDateFormatterTest.java
+++ b/gerrit-gwtui-common/src/test/java/com/google/gerrit/client/RelativeDateFormatterTest.java
@@ -98,6 +98,7 @@
     assertFormat(410, DAY_IN_MILLIS, "1 year, 2 months ago");
     assertFormat(2, YEAR_IN_MILLIS, "2 years ago");
     assertFormat(1824, DAY_IN_MILLIS, "5 years ago");
+    assertFormat(2 * 365 - 10, DAY_IN_MILLIS, "2 years ago");
   }
 
   @Test