aboutsummaryrefslogtreecommitdiff
path: root/src/client/View/Date.elm
diff options
context:
space:
mode:
authorJoris2017-03-26 21:10:42 +0200
committerJoris2017-03-26 21:10:42 +0200
commit1e47a7754ca38bd1a6c74765d8378caf68ce4619 (patch)
treed0d9238479dc2529a1b558bbbcde346e7e8c2935 /src/client/View/Date.elm
parentc0ac16a713c4e53cf6af8e72a6d5f6b8ac5d6456 (diff)
downloadbudget-1e47a7754ca38bd1a6c74765d8378caf68ce4619.tar.gz
budget-1e47a7754ca38bd1a6c74765d8378caf68ce4619.tar.bz2
budget-1e47a7754ca38bd1a6c74765d8378caf68ce4619.zip
Separate client and server watch
Diffstat (limited to 'src/client/View/Date.elm')
-rw-r--r--src/client/View/Date.elm48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/client/View/Date.elm b/src/client/View/Date.elm
new file mode 100644
index 0000000..35806ba
--- /dev/null
+++ b/src/client/View/Date.elm
@@ -0,0 +1,48 @@
+module View.Date exposing
+ ( shortView
+ , longView
+ , monthView
+ )
+
+import Date exposing (..)
+import Date.Extra.Core as Date
+import String
+
+import Model.Translations exposing (..)
+
+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"