Skip to content

Commit

Permalink
Merge pull request #17 from akovari/master
Browse files Browse the repository at this point in the history
Changing mgold's elm-date-format dependency for more powerful rluiten…
  • Loading branch information
gdotdesign committed Mar 4, 2016
2 parents 68badd2 + c1954a6 commit 83d26f2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion elm-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"deadfoxygrandpa/elm-test": "3.0.1 <= v < 4.0.0",
"laszlopandy/elm-console" : "1.0.3 <= v < 2.0.0",
"coreytrampe/elm-vendor": "2.0.0 <= v < 3.0.0",
"mgold/elm-date-format": "1.0.3 <= v < 2.0.0",
"rluiten/elm-date-extra": "2.2.1 <= v < 3.0.0",
"evancz/elm-markdown": "2.0.0 <= v < 3.0.0",
"evancz/virtual-dom": "2.1.0 <= v < 3.0.0",
"evancz/elm-effects": "2.0.0 <= v < 3.0.0",
Expand Down
8 changes: 6 additions & 2 deletions source/Ui/Calendar.elm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import Html.Events exposing (onMouseDown)
import Html exposing (node, text, span)
import Html.Lazy

import Date.Format exposing (format)
import Date.Format exposing (isoDateFormat, format)
import Date.Config.Configs as DateConfigs
import Time exposing (Time)
import Ext.Signal
import Ext.Date
Expand All @@ -47,6 +48,7 @@ type alias Model =
, date : Date.Date
, disabled : Bool
, readonly : Bool
, locale : String
}

{-| Actions that a calendar can make. -}
Expand All @@ -68,6 +70,7 @@ init date =
, readonly = False
, value = date
, date = date
, locale = "en_us"
}

{-| Initializes a calendar with the given value and value address.
Expand All @@ -82,6 +85,7 @@ initWithAddress valueAddress date =
, readonly = False
, value = date
, date = date
, locale = "en_us"
}

{-| Updates a calendar. -}
Expand Down Expand Up @@ -154,7 +158,7 @@ render address model =
, align = "stretch"
, direction = "row" } []
[ Ui.icon "chevron-left" (not model.readonly) previousAction
, node "div" [] [text (format "%Y - %B" month)]
, node "div" [] [text (format (DateConfigs.getConfig model.locale) "%Y - %B" month)]
, Ui.icon "chevron-right" (not model.readonly) nextAction
]
in
Expand Down
12 changes: 8 additions & 4 deletions source/Ui/DatePicker.elm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import Ext.Signal
import Effects
import Dict

import Date.Format exposing (format)
import Date.Format exposing (isoDateFormat, format)
import Date.Config.Configs as DateConfigs
import Time
import Date

Expand All @@ -49,6 +50,7 @@ type alias Model =
, dropdownPosition : String
, closeOnSelect : Bool
, format : String
, locale : String
, disabled : Bool
, readonly : Bool
, open : Bool
Expand Down Expand Up @@ -77,7 +79,8 @@ init address date =
, dropdownPosition = "bottom"
, closeOnSelect = False
, calendar = Calendar.init date
, format = "%Y-%m-%d"
, format = isoDateFormat
, locale = "en_us"
, disabled = False
, readonly = False
, open = False
Expand All @@ -97,7 +100,8 @@ initWithAddress valueAddress address date =
, dropdownPosition = "bottom"
, closeOnSelect = False
, calendar = Calendar.initWithAddress (forwardTo address Select) date
, format = "%Y-%m-%d"
, format = isoDateFormat
, locale = "en_us"
, disabled = False
, readonly = False
, open = False
Expand Down Expand Up @@ -179,7 +183,7 @@ render address model =
, ("readonly", model.readonly)
]
] ++ actions ++ (Ui.tabIndex model))
[ div [] [text (format model.format model.calendar.value)]
[ div [] [text (format (DateConfigs.getConfig model.locale) model.format model.calendar.value)]
, Ui.icon "calendar" False []
, Dropdown.view model.dropdownPosition
[ node "ui-dropdown-overlay" [onClick address Blur] []
Expand Down

0 comments on commit 83d26f2

Please sign in to comment.