optimistic update message on send

This commit is contained in:
2026-05-15 09:41:50 +07:00
parent 620f7e0918
commit d56847f5d4
5 changed files with 84 additions and 25 deletions
@@ -125,6 +125,27 @@ fun Timestamp.ago(): String {
}
}
fun Timestamp.formatAsGroupHeader(): String {
val timeZone = TimeZone.currentSystemDefault()
val inputInstant = Instant.fromEpochSeconds(this.asSecs().toLong())
val inputDate = inputInstant.toLocalDateTime(timeZone).date
val now = Clock.System.now()
val today = now.toLocalDateTime(timeZone).date
val yesterday = today.minus(1, DateTimeUnit.DAY)
return when (inputDate) {
today -> "Today"
yesterday -> "Yesterday"
else -> {
val day = inputDate.day.toString().padStart(2, '0')
val month = inputDate.month.number.toString().padStart(2, '0')
val year = inputDate.year.toString().takeLast(2)
"$day/$month/$year"
}
}
}
fun Timestamp.humanReadable(): String {
val timeZone = TimeZone.currentSystemDefault()
val inputInstant = Instant.fromEpochSeconds(this.asSecs().toLong())