blob: bfba02f5eeb7d96093a3b4f79c538417fc7230c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
module Model.Date exposing
( timeDecoder
, dateDecoder
)
import Date as Date exposing (Date)
import Json.Decode as Decode exposing (Decoder)
import Json.Decode.Extra as Decode
import Time exposing (Time)
timeDecoder : Decoder Time
timeDecoder = Decode.map Date.toTime dateDecoder
dateDecoder : Decoder Date
dateDecoder = Decode.string |> Decode.andThen (Date.fromString >> Decode.fromResult)
|