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

ui: Add friendly date to Mailbox message view

- Refactor some date stuff
This commit is contained in:
James Hillyerd
2018-11-08 20:20:38 -08:00
parent d05eb10851
commit c92cd309bc
5 changed files with 54 additions and 25 deletions

21
ui/src/Data/Date.elm Normal file
View File

@@ -0,0 +1,21 @@
module Data.Date exposing (..)
import Date exposing (Date)
import Json.Decode as Decode exposing (..)
{-| Decode an ISO 8601 date
-}
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