Created
December 8, 2015 17:25
-
-
Save fredcy/489565cc44930c095231 to your computer and use it in GitHub Desktop.
Show how Elm displays time and date values as strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Date | |
import Effects | |
import Html exposing (li, text, ul) | |
import StartApp | |
import Time | |
app = | |
StartApp.start | |
{ init = (0, Effects.none) | |
, inputs = [Time.every Time.second] | |
, update = \t -> always (t, Effects.none) | |
, view = always showTime | |
} | |
showTime t = | |
ul [] | |
[ li [] [ t |> toString |> text ] | |
, li [] [ t |> Date.fromTime |> toString |> text ] | |
] | |
main = app.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment