diff options
author | Joris | 2015-09-03 21:56:17 +0200 |
---|---|---|
committer | Joris | 2015-09-03 21:56:17 +0200 |
commit | ebd304d97b612d0ac4ea276b1c29ba8ecc0b7998 (patch) | |
tree | 31f2d80792228b399e0a8a93f4ad15b629d5ebe2 /src/client/View/Date.elm | |
parent | c7ca925e44c118189b6f27c40955640090f6cd20 (diff) |
Adapting design to smaller screens
Diffstat (limited to 'src/client/View/Date.elm')
-rw-r--r-- | src/client/View/Date.elm | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/client/View/Date.elm b/src/client/View/Date.elm index c96e99e..c239713 100644 --- a/src/client/View/Date.elm +++ b/src/client/View/Date.elm @@ -1,19 +1,46 @@ module View.Date - ( renderDate + ( renderShortDate + , renderLongDate ) where import Date exposing (..) +import String import Model.Translations exposing (..) -renderDate : Date -> Translations -> String -renderDate date translations = +renderShortDate : Date -> Translations -> String +renderShortDate date translations = + let params = + [ String.pad 2 '0' (toString (Date.day date)) + , String.pad 2 '0' (toString (getMonthNumber (Date.month date))) + , toString (Date.year date) + ] + in getVarMessage params "ShortDate" translations + +renderLongDate : Date -> Translations -> String +renderLongDate date translations = let params = [ toString (Date.day date) , (getMessage (getMonthKey (Date.month date)) translations) , toString (Date.year date) ] - in getVarMessage params "Date" translations + in getVarMessage params "LongDate" translations + +getMonthNumber : Month -> Int +getMonthNumber month = + case month of + Jan -> 1 + Feb -> 2 + Mar -> 3 + Apr -> 4 + May -> 5 + Jun -> 6 + Jul -> 7 + Aug -> 8 + Sep -> 9 + Oct -> 10 + Nov -> 11 + Dec -> 12 getMonthKey : Month -> String getMonthKey month = |