blob: 2cc55fe3f3449452212f020f475278aeab6336b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
module LoggedIn.Home.View.Date
( renderShortDate
, renderLongDate
) where
import Date exposing (..)
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 (getMonthNumber (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
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 =
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"
|