module LoggedIn.View.Date ( renderShortDate , renderLongDate ) where import Date exposing (..) import Utils.Date exposing (monthToNum) import String import Model.Translations exposing (..) renderShortDate : Date -> Translations -> String renderShortDate date translations = let params = [ String.pad 2 '0' (toString (Date.day date)) , String.pad 2 '0' (toString (monthToNum (Date.month date))) , toString (Date.year date) ] in getParamMessage 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 getParamMessage params "LongDate" translations getMonthKey : Month -> String getMonthKey month = case month of Jan -> "January" Feb -> "February" Mar -> "March" Apr -> "April" May -> "May" Jun -> "June" Jul -> "July" Aug -> "August" Sep -> "September" Oct -> "October" Nov -> "November" Dec -> "December"