1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-18 10:07:02 +00:00

ui: Friendly date format for mailbox list, monitor

This commit is contained in:
James Hillyerd
2018-11-06 20:47:15 -08:00
parent 9e2f138279
commit d05eb10851
5 changed files with 104 additions and 29 deletions

View File

@@ -1,5 +1,6 @@
module Data.MessageHeader exposing (..)
import Date exposing (Date)
import Json.Decode as Decode exposing (..)
import Json.Decode.Pipeline exposing (..)
@@ -10,7 +11,7 @@ type alias MessageHeader =
, from : String
, to : List String
, subject : String
, date : String
, date : Date
, size : Int
, seen : Bool
}
@@ -24,6 +25,21 @@ decoder =
|> optional "from" string ""
|> required "to" (list string)
|> optional "subject" string ""
|> required "date" string
|> required "date" date
|> required "size" int
|> required "seen" bool
date : Decoder Date
date =
let
convert : String -> Decoder Date
convert raw =
case Date.fromString raw of
Ok date ->
succeed date
Err error ->
fail error
in
string |> andThen convert