Format the "updated" timestamp as a locale-aware date/time
Replaces the raw "2026-09-10 10:03:54" with each platform's own locale-formatted, no-seconds rendering (e.g. "Sep 10, 2026, 10:03 AM" in en-US) — mirroring how amounts are already locale-formatted elsewhere (NumberFormat.kt). Android uses the pre-java.time Calendar/DateFormat APIs since minSdk 24 predates java.time (API 26) and the project has no core library desugaring configured. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FXcrACM5sok3M1KQJ8kByy
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package xyz.tyiu.satsprice.domain
|
||||
|
||||
import kotlinx.datetime.LocalDateTime
|
||||
import kotlinx.datetime.toJavaLocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.time.format.FormatStyle
|
||||
import java.util.Locale
|
||||
|
||||
actual fun localizedDateTime(dateTime: LocalDateTime): String {
|
||||
val formatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM, FormatStyle.SHORT)
|
||||
.withLocale(Locale.getDefault())
|
||||
return dateTime.toJavaLocalDateTime().format(formatter)
|
||||
}
|
||||
Reference in New Issue
Block a user