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:
21
ui/src/Data/Date.elm
Normal file
21
ui/src/Data/Date.elm
Normal 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
|
||||
Reference in New Issue
Block a user