module View.Date exposing ( shortMonthAndYear , shortView , longView , monthView ) import Date exposing (..) import Date.Extra.Core as Date import String import Model.Translations exposing (..) shortMonthAndYear : Month -> Int -> Translations -> String shortMonthAndYear month year translations = let params = [ String.pad 2 '0' (toString (Date.monthToInt month)) , toString year ] in getParamMessage params translations "ShortMonthAndYear" shortView : Date -> Translations -> String shortView date translations = let params = [ String.pad 2 '0' (toString (Date.day date)) , String.pad 2 '0' (toString (Date.monthToInt (Date.month date))) , toString (Date.year date) ] in getParamMessage params translations "ShortDate" longView : Date -> Translations -> String longView date translations = let params = [ toString (Date.day date) , (getMessage translations (getMonthKey (Date.month date))) , toString (Date.year date) ] in getParamMessage params translations "LongDate" monthView : Translations -> Month -> String monthView translations month = getMessage translations (getMonthKey month) 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"