mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Use LocalDate.ofInstant()
This commit is contained in:
parent
c7c3d87ee5
commit
3dc29b1983
@ -64,9 +64,7 @@ object TextUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun formatRelativeDate(context: Context, unixTime: Long): CharSequence {
|
fun formatRelativeDate(context: Context, unixTime: Long): CharSequence {
|
||||||
// TODO: Use LocalDate.ofInstant() when it is available in SDK 34.
|
val date = LocalDate.ofInstant(Instant.ofEpochMilli(unixTime), ZoneId.systemDefault())
|
||||||
val date = LocalDateTime.ofInstant(Instant.ofEpochMilli(unixTime), ZoneId.systemDefault())
|
|
||||||
.toLocalDate()
|
|
||||||
val now = LocalDate.now()
|
val now = LocalDate.now()
|
||||||
val months = date.until(now, ChronoUnit.MONTHS)
|
val months = date.until(now, ChronoUnit.MONTHS)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user