From 3dc29b19837e576259c0e705cd74fd32ccfcd3c2 Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Wed, 26 Jul 2023 05:29:34 +0530 Subject: [PATCH] Use LocalDate.ofInstant() --- app/src/main/java/com/github/libretube/util/TextUtils.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 5bb5f4f7b..9b23ce1e3 100644 --- a/app/src/main/java/com/github/libretube/util/TextUtils.kt +++ b/app/src/main/java/com/github/libretube/util/TextUtils.kt @@ -64,9 +64,7 @@ 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()) - .toLocalDate() + val date = LocalDate.ofInstant(Instant.ofEpochMilli(unixTime), ZoneId.systemDefault()) val now = LocalDate.now() val months = date.until(now, ChronoUnit.MONTHS)