fix: contact placeholder date when time is zero

This commit is contained in:
andrekir 2024-10-29 08:15:50 -03:00
parent be445d7ed7
commit 6526c91f3a

View file

@ -143,8 +143,8 @@ data class Contact(
)
// return time if within 24 hours, otherwise date
private fun getShortDate(time: Long): String {
val date = Date(time)
private fun getShortDate(time: Long): String? {
val date = if (time != 0L) Date(time) else return null
val isWithin24Hours = System.currentTimeMillis() - date.time <= TimeUnit.DAYS.toMillis(1)
return if (isWithin24Hours) {