Skip to content

Instantly share code, notes, and snippets.

@Taneb
Created September 4, 2015 14:54
Show Gist options
  • Save Taneb/8bbd177f95ebea9b590c to your computer and use it in GitHub Desktop.
Save Taneb/8bbd177f95ebea9b590c to your computer and use it in GitHub Desktop.
import Graphics.Element exposing (Element)
import Graphics.Collage exposing (collage, toForm, text)
import Signal exposing ((<~))
import Time exposing (Time, every)
import Date exposing (fromTime, hour, minute, second)
import String exposing (padLeft)
import Text exposing (Text, fromString, monospace, height)
import List exposing (map)
main = showTime <~ every Time.second
dateToString : Time -> String
dateToString t =
String.join ":" <| map (\f -> padLeft 2 '0' << toString << f <| fromTime t) [hour, minute, second]
styleDate : String -> Text
styleDate = fromString >> monospace >> height 100
showTime : Time -> Element
showTime t = collage 700 700 [t |> dateToString >> styleDate >> text]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment