M7: polish + E2E + docs (layout pass, theming, states, e2e driver, schema, setup.md, security)
This commit is contained in:
1 parent
0cc8b7aafe
commit
bf6bf7e8bd
26 files changed
+2225
-327
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package iris.util
|
||||
|
||||
import java.time.Instant
|
||||
import java.time.ZoneId
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.util.Locale
|
||||
|
||||
// jvmMain is the intermediate source set for both androidMain (minSdk 29,
|
||||
// java.time available) and desktopMain, so one actual covers both targets.
|
||||
|
||||
actual fun formatDayLabel(epochMillis: Long): String {
|
||||
if (epochMillis <= 0) return ""
|
||||
val zone = ZoneId.systemDefault()
|
||||
val date = Instant.ofEpochMilli(epochMillis).atZone(zone)
|
||||
val now = Instant.now().atZone(zone)
|
||||
val pattern = if (date.year == now.year) "d. MMMM" else "d. MMMM, yyyy"
|
||||
return DateTimeFormatter.ofPattern(pattern, Locale.getDefault()).format(date)
|
||||
}
|
||||
|
||||
actual fun formatTime(epochMillis: Long): String {
|
||||
if (epochMillis <= 0) return ""
|
||||
return DateTimeFormatter.ofPattern("HH:mm", Locale.getDefault())
|
||||
.format(Instant.ofEpochMilli(epochMillis).atZone(ZoneId.systemDefault()))
|
||||
}
|
||||
|
||||
actual fun localDayKey(epochMillis: Long): String =
|
||||
Instant.ofEpochMilli(epochMillis).atZone(ZoneId.systemDefault()).toLocalDate().toString()
|
||||
Reference in new issue
Block a user