import { Date, 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)}";
	}

	pure callback format-date(Date) -> string;

	in property <Date> current-date;
	in property <Time> current-time;
}
