mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-31 15:47:26 +00:00
Fix time display in home automation demo (#8392)
Show 12 instead of 0 for noon/midnight and fix AM/PM logic
This commit is contained in:
parent
9289940371
commit
37ad2445a7
1 changed files with 2 additions and 2 deletions
|
@ -140,7 +140,7 @@ export component MainScreen inherits Rectangle {
|
|||
if showing-time: HorizontalLayout {
|
||||
alignment: center;
|
||||
HaText {
|
||||
text: Api.current-time.hour.mod(12);
|
||||
text: Api.current-time.hour.mod(12) == 0 ? 12 : Api.current-time.hour.mod(12);
|
||||
horizontal-alignment: center;
|
||||
vertical-alignment: center;
|
||||
color: Palette.info-foreground;
|
||||
|
@ -164,7 +164,7 @@ export component MainScreen inherits Rectangle {
|
|||
}
|
||||
|
||||
HaText {
|
||||
text: Api.current-time.hour > 12 ? " PM" : " AM";
|
||||
text: Api.current-time.hour >= 12 ? " PM" : " AM";
|
||||
horizontal-alignment: center;
|
||||
vertical-alignment: center;
|
||||
color: Palette.info-foreground;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue