Skip to content

Instantly share code, notes, and snippets.

@fredcy
Created December 8, 2015 17:25
Show Gist options
  • Save fredcy/489565cc44930c095231 to your computer and use it in GitHub Desktop.
Save fredcy/489565cc44930c095231 to your computer and use it in GitHub Desktop.
Show how Elm displays time and date values as strings
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