Modern Apps git

← Modern-Apps.git

weather: hourly strip uses bare hour in 24h mode (#tests)

Commit
36f1234ea9661e5fb564cb40b13a9a111780f397
Author
Vayun Mathur <[email protected]>
When
2026-11-14 23:11 UTC (21 days ago)
Parents
c72b721
DomainFormatTest.epochLabelsUtc/LocationOffset expected
formatStripHour(.., use24Hour=true) to render the bare hour
("15"/"5"), matching its doc ("3 PM" / "9") and the hourly
strip UI, but it formatted with HourOfDayWithZero ("15:00").
Use HourOfDayBare for the strip; the hour axis keeps
HourOfDayWithZero via DateString.hourLabel ("05:00").

Verified: ./gradlew :weather:testDevUnitTest green.

Diff

weather/src/main/java/com/vayunmathur/weather/domain/DateTimeFormat.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/domain/DateTimeFormat.kt b/weather/src/main/java/com/vayunmathur/weather/domain/DateTimeFormat.ktindex 7268b4bc89..2d9720ba31 100644--- a/weather/src/main/java/com/vayunmathur/weather/domain/DateTimeFormat.kt+++ b/weather/src/main/java/com/vayunmathur/weather/domain/DateTimeFormat.kt@@ -82,7 +82,7 @@ fun formatHourAxisLabel(epochSec: Long, use24Hour: Boolean, utcOffsetSeconds: In  /** Hourly-strip label "3 PM" / "9" for an epoch second in the location's zone. */ fun formatStripHour(epochSec: Long, use24Hour: Boolean, utcOffsetSeconds: Int? = null): String =-    localTimeAt(epochSec, utcOffsetSeconds).format(if (use24Hour) HourOfDayWithZero else HourAmPm)+    localTimeAt(epochSec, utcOffsetSeconds).format(if (use24Hour) HourOfDayBare else HourAmPm)  /** Clock time "3:05 PM" / "15:00" for an epoch second in the location's zone. */ fun formatClockTime(epochSec: Long, use24Hour: Boolean, utcOffsetSeconds: Int? = null): String =