mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-02 01:13:19 +00:00
17 lines
380 B
Text
17 lines
380 B
Text
import { Time } from "std-widgets.slint";
|
|
|
|
export global Utils {
|
|
pure function format-zero-padding(number: int) -> string {
|
|
if (number < 10) {
|
|
return "0\{number}";
|
|
}
|
|
return number;
|
|
}
|
|
|
|
public pure function time-to-string(time: Time) -> string {
|
|
if (time.minute == 0) {
|
|
return "\{time.hour}";
|
|
}
|
|
return "\{time.hour}:\{format-zero-padding(time.minute)}";
|
|
}
|
|
}
|