Agenda widget: format the month label outside the composable (#71)

This commit is contained in:
2026-10-23 15:16:28 +02:00
parent 6da0648b77
commit d43a741c93
@@ -316,12 +316,7 @@ private fun agendaCardColor(): ColorProvider = when (LocalWidgetBackground.curre
@Composable
private fun MonthLabel(date: LocalDate, today: LocalDate, metrics: AgendaMetrics) {
Text(
text = formatCalendarTitle(
date = java.time.LocalDate.of(date.year, date.month.ordinal + 1, 1),
locale = Locale.getDefault(),
currentYear = today.year,
skeleton = "LLLL",
),
text = monthName(date, today),
maxLines = 1,
style = TextStyle(
color = GlanceTheme.colors.onSurfaceVariant,
@@ -492,6 +487,13 @@ private fun agendaDayLabel(context: Context, date: LocalDate, today: LocalDate):
return if (relative != null) "$relative · $formatted" else formatted
}
private fun monthName(date: LocalDate, today: LocalDate): String = formatCalendarTitle(
date = java.time.LocalDate.of(date.year, date.month.ordinal + 1, 1),
locale = Locale.getDefault(),
currentYear = today.year,
skeleton = "LLLL",
)
private fun weekdayShort(date: LocalDate): String =
date.dayOfWeek.toJavaDayOfWeek().getDisplayName(java.time.format.TextStyle.SHORT, Locale.getDefault())