mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-04-19 22:37:09 -04:00
[app] Show more precise relative last updated dates
This commit is contained in:
committed by
Hans-Christoph Steiner
parent
f82f580aca
commit
6fadebe4e2
@@ -623,11 +623,11 @@ public final class Utils {
|
||||
|
||||
if (days < 1) {
|
||||
return res.getString(R.string.details_last_updated_today);
|
||||
} else if (weeks < 1) {
|
||||
} else if (weeks < 3) {
|
||||
return res.getQuantityString(R.plurals.details_last_update_days, (int) days, days);
|
||||
} else if (months < 1) {
|
||||
} else if (months < 2) {
|
||||
return res.getQuantityString(R.plurals.details_last_update_weeks, (int) weeks, weeks);
|
||||
} else if (years < 1) {
|
||||
} else if (years < 2) {
|
||||
return res.getQuantityString(R.plurals.details_last_update_months, (int) months, months);
|
||||
} else {
|
||||
return res.getQuantityString(R.plurals.details_last_update_years, (int) years, years);
|
||||
|
||||
@@ -191,5 +191,13 @@ public class UtilsTest {
|
||||
"Updated 3 days ago",
|
||||
Utils.formatLastUpdated(res, now - 234834870L)
|
||||
);
|
||||
assertEquals(
|
||||
"Updated 13 days ago",
|
||||
Utils.formatLastUpdated(res, now - DateUtils.DAY_IN_MILLIS * 13 - offset)
|
||||
);
|
||||
assertEquals(
|
||||
"Updated 7 months ago",
|
||||
Utils.formatLastUpdated(res, now - DateUtils.DAY_IN_MILLIS * 30 * 7 + offset)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user