diff --git a/examples/08-time.elm b/examples/08-time.elm index 9f6ed6b..2959562 100644 --- a/examples/08-time.elm +++ b/examples/08-time.elm @@ -73,9 +73,14 @@ subscriptions model = view : Model -> Html Msg view model = - let - hour = String.fromInt (Time.toHour model.zone model.time) - minute = String.fromInt (Time.toMinute model.zone model.time) - second = String.fromInt (Time.toSecond model.zone model.time) - in - h1 [] [ text (hour ++ ":" ++ minute ++ ":" ++ second) ] \ No newline at end of file + let + hour = + String.padLeft 2 '0' (String.fromInt (Time.toHour model.zone model.time)) + + minute = + String.padLeft 2 '0' (String.fromInt (Time.toMinute model.zone model.time)) + + second = + String.padLeft 2 '0' (String.fromInt (Time.toSecond model.zone model.time)) + in + h1 [] [ text (hour ++ ":" ++ minute ++ ":" ++ second) ]