mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 06:40:30 +05:30
Use only the date in relative time formatting.
This commit is contained in:
parent
7d216cd9fa
commit
21eae99eae
@ -64,8 +64,10 @@ 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 = LocalDateTime.ofInstant(Instant.ofEpochMilli(unixTime), ZoneId.systemDefault())
|
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)
|
val weeks = date.until(now, ChronoUnit.WEEKS)
|
||||||
|
|
||||||
return if (weeks > 0) {
|
return if (weeks > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user