use compose-observable locale in DayHeader

This commit is contained in:
Damocles 2026-04-22 21:26:32 +02:00
parent cf82b4b586
commit b21c4d0f46

View file

@ -44,7 +44,6 @@ import space.darkest.nova.android.data.AgendaEvent
import java.time.LocalDate import java.time.LocalDate
import java.time.format.DateTimeFormatter import java.time.format.DateTimeFormatter
import java.time.format.TextStyle import java.time.format.TextStyle
import java.util.Locale
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
@ -114,13 +113,14 @@ fun AgendaScreen(agenda: List<AgendaDay>) {
@Composable @Composable
private fun DayHeader(date: LocalDate) { private fun DayHeader(date: LocalDate) {
val locale = androidx.compose.ui.text.intl.Locale.current.platformLocale
val today = LocalDate.now() val today = LocalDate.now()
val label = when (date) { val label = when (date) {
today -> "Today" today -> "Today"
today.plusDays(1) -> "Tomorrow" today.plusDays(1) -> "Tomorrow"
else -> { else -> {
val dayName = date.dayOfWeek.getDisplayName(TextStyle.FULL, Locale.getDefault()) val dayName = date.dayOfWeek.getDisplayName(TextStyle.FULL, locale)
val monthDay = date.format(DateTimeFormatter.ofPattern("MMM d")) val monthDay = date.format(DateTimeFormatter.ofPattern("MMM d", locale))
"$dayName, $monthDay" "$dayName, $monthDay"
} }
} }