aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Utils/Date.elm
blob: 7a245bc4b692750b3da0079d35a52b2ffafd66f6 (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
module Utils.Date
  ( monthToNum
  , numToMonth
  ) where

import Date exposing (..)

monthToNum : Month -> Int
monthToNum 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

numToMonth : Int -> Month
numToMonth n =
  case n of
    1  -> Jan
    2  -> Feb
    3  -> Mar
    4  -> Apr
    5  -> May
    6  -> Jun
    7  -> Jul
    8  -> Aug
    9  -> Sep
    10 -> Oct
    11 -> Nov
    12 -> Dec
    _ -> Jan