This commit is contained in:
Diogo
2024-09-20 16:14:18 +01:00
parent 53cce6855f
commit e03d344397
2 changed files with 7 additions and 8 deletions
@@ -2423,11 +2423,11 @@ data class CITimed(
val deleteAt: Instant?
)
fun getDateText(t: Instant): String {
fun getTimestampDateText(t: Instant): String {
val tz = TimeZone.currentSystemDefault()
val time = t.toLocalDateTime(tz)
val weekday = time.toJavaLocalDateTime().format(DateTimeFormatter.ofPattern("EEE", Locale.getDefault()))
val dayMonthYear = time.toJavaLocalDateTime().format(DateTimeFormatter.ofPattern(
val time = t.toLocalDateTime(tz).toJavaLocalDateTime()
val weekday = time.format(DateTimeFormatter.ofPattern("EEE", Locale.getDefault()))
val dayMonthYear = time.format(DateTimeFormatter.ofPattern(
if (Clock.System.now().toLocalDateTime(tz).year == time.year) "d MMM" else "d MMM YYYY",
Locale.getDefault())
)
@@ -43,7 +43,6 @@ import kotlinx.coroutines.flow.*
import kotlinx.datetime.*
import java.io.File
import java.net.URI
import java.time.format.DateTimeFormatter
import kotlin.math.abs
import kotlin.math.sign
@@ -1518,8 +1517,8 @@ private fun ButtonRow(horizontalArrangement: Arrangement.Horizontal, content: @C
@Composable
fun DateSeparator(date: Instant) {
Text(
text = getDateText(date),
fontSize = 16.sp,
text = getTimestampDateText(date),
fontSize = 14.sp,
fontWeight = FontWeight.Medium,
color = MaterialTheme.colors.secondary
)
@@ -1912,7 +1911,7 @@ private fun getItemSeparation(chatItem: ChatItem, nextItem: ChatItem?): ItemSepa
return ItemSeparation(
timestamp = largeGap || chatItem.meta.timestampText != nextItem.meta.timestampText,
largeGap = largeGap,
date = if (getDateText(chatItem.meta.itemTs) != getDateText(nextItem.meta.itemTs)) nextItem.meta.itemTs else null
date = if (getTimestampDateText(chatItem.meta.itemTs) != getTimestampDateText(nextItem.meta.itemTs)) nextItem.meta.itemTs else null
)
}