Skip to content

Commit

Permalink
Merge pull request #16 from dwyl/bugfixes
Browse files Browse the repository at this point in the history
Bugfixes
  • Loading branch information
nelsonic authored May 1, 2018
2 parents c8b83c7 + 19b8622 commit 5802af5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion elm-package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.0.0",
"version": "2.1.0",
"summary": "A customisable date picker written in Elm",
"repository": "https://github.com/dwyl/elm-datepicker.git",
"license": "BSD3",
Expand Down
25 changes: 22 additions & 3 deletions src/DatePicker.elm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module DatePicker
, isOpen
, getMonth
, getNextMonth
, getSelectedDate
, clearDates
, toggleCalendar
, cancelDates
Expand All @@ -30,7 +31,7 @@ module DatePicker
These functions allow you to access data from the DatePicker model.
@docs getFrom, getTo, getMonth, getNextMonth, isOpen
@docs getFrom, getTo, getMonth, getNextMonth, isOpen, getSelectedDate
# API Functions
Expand Down Expand Up @@ -450,10 +451,28 @@ update msg (DatePicker model) =
DatePicker ({ model | overDate = date })

CancelDates ->
DatePicker ({ model | from = Nothing, to = Nothing, single = Nothing, open = False, selectDate = From })
let
selection =
case model.selectDate of
Only ->
Only

_ ->
From
in
DatePicker ({ model | from = Nothing, to = Nothing, single = Nothing, open = False, selectDate = selection })

ClearDates ->
DatePicker ({ model | from = Nothing, to = Nothing, single = Nothing, selectDate = From })
let
selection =
case model.selectDate of
Only ->
Only

_ ->
From
in
DatePicker ({ model | from = Nothing, to = Nothing, single = Nothing, selectDate = selection })


{-| Get the `from` date in a selected range
Expand Down

0 comments on commit 5802af5

Please sign in to comment.