From 6526c91f3ab2e07a5cde2ee3a97a1bc566aa911c Mon Sep 17 00:00:00 2001 From: andrekir Date: Tue, 29 Oct 2024 08:15:50 -0300 Subject: [PATCH] fix: contact placeholder date when time is zero --- app/src/main/java/com/geeksville/mesh/model/UIState.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/geeksville/mesh/model/UIState.kt b/app/src/main/java/com/geeksville/mesh/model/UIState.kt index a41b1cf95..7f9c6e130 100644 --- a/app/src/main/java/com/geeksville/mesh/model/UIState.kt +++ b/app/src/main/java/com/geeksville/mesh/model/UIState.kt @@ -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) {