Skip to content

Commit

Permalink
fix: contact placeholder date when time is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
andrekir committed Oct 29, 2024
1 parent be445d7 commit 6526c91
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/com/geeksville/mesh/model/UIState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6526c91

Please sign in to comment.