From 21eae99eaeb44d26b48b1c006a4260fc6eb46725 Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Mon, 20 Mar 2023 08:47:14 +0530 Subject: [PATCH] Use only the date in relative time formatting. --- app/src/main/java/com/github/libretube/util/TextUtils.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/libretube/util/TextUtils.kt b/app/src/main/java/com/github/libretube/util/TextUtils.kt index e2b126d5a..400652dea 100644 --- a/app/src/main/java/com/github/libretube/util/TextUtils.kt +++ b/app/src/main/java/com/github/libretube/util/TextUtils.kt @@ -64,8 +64,10 @@ object TextUtils { } fun formatRelativeDate(context: Context, unixTime: Long): CharSequence { + // TODO: Use LocalDate.ofInstant() when it is available in SDK 34. val date = LocalDateTime.ofInstant(Instant.ofEpochMilli(unixTime), ZoneId.systemDefault()) - val now = LocalDateTime.now() + .toLocalDate() + val now = java.time.LocalDate.now() val weeks = date.until(now, ChronoUnit.WEEKS) return if (weeks > 0) {