refactor(ui): move the alarm time formatter where both screens can reach it

The ring screen wrote it first; the alarms list needs the same 12/24-hour
rendering. Moved rather than copied.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wmy1BpCKi8KeSjaWhYuCPV
This commit is contained in:
2026-09-12 14:43:46 +02:00
co-authored by Claude Opus 5
parent b5ec07b470
commit 4662aee90d
2 changed files with 7 additions and 2 deletions
@@ -1,4 +1,4 @@
package de.jeanlucmakiola.clockula.ui.ring
package de.jeanlucmakiola.clockula.ui.common
import android.text.format.DateFormat
import androidx.compose.runtime.Composable
@@ -10,7 +10,11 @@ import java.time.LocalTime
import java.time.format.DateTimeFormatter
import java.time.format.FormatStyle
/** Honours the user's 12/24-hour setting. Deliberately not unit-tested: it is one platform call. */
/**
* Honours the user's 12/24-hour setting. Deliberately not unit-tested: it is
* one platform call. Shared by the ring screen, the alarm list and the editor,
* so all three read a time the same way (M5).
*/
@Composable
internal fun rememberAlarmTimeFormatter(): (TimeOfDay) -> String {
val context = LocalContext.current
@@ -33,6 +33,7 @@ import androidx.compose.ui.draw.scale
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import de.jeanlucmakiola.clockula.R
import de.jeanlucmakiola.clockula.ui.common.rememberAlarmTimeFormatter
import de.jeanlucmakiola.floret.identity.collapseExit
import de.jeanlucmakiola.floret.identity.expandEnter
import de.jeanlucmakiola.floret.identity.rememberReduceMotion