Merge branch 'stable-2.14' into stable-2.15
* stable-2.14: RelativeDateFormatter: Fix bad rounding of "1 year 12 months" to "2 year" Change-Id: I9a59d799f4b3858dace45ac82aa03b3e318177f7
This commit is contained in:
commit
64db41de37
@ -123,6 +123,9 @@ public class RelativeDateFormatter {
|
||||
}
|
||||
if (months == 12) {
|
||||
years++;
|
||||
if (years > 1) {
|
||||
yearLabel = c().years();
|
||||
}
|
||||
return m().years0MonthsAgo(years, yearLabel);
|
||||
}
|
||||
return m().yearsMonthsAgo(years, yearLabel, months, monthLabel);
|
||||
|
@ -98,6 +98,7 @@ public class RelativeDateFormatterTest {
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user