Skip to content

Commit

Permalink
Merge pull request #18 from dwyl/select
Browse files Browse the repository at this point in the history
Select function
  • Loading branch information
nelsonic authored May 1, 2018
2 parents 5802af5 + c82b3d5 commit e94ea17
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.1.0",
"version": "2.2.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 @@ -20,11 +20,12 @@ module DatePicker
, previousMonth
, nextMonth
, receiveDate
, setDate
)

{-| A customisable DatePicker that easily allows you to select a range of dates
@docs DatePicker, Msg, Config, defaultConfig, initCalendar, showCalendar, update, Selection
@docs DatePicker, Msg, Config, defaultConfig, initCalendar, showCalendar, update, Selection, receiveDate
# Getter Functions
Expand All @@ -36,9 +37,20 @@ These functions allow you to access data from the DatePicker model.
# API Functions
These functions allow us to perform updates to the datepicker model
These functions allow us to perform updates to the datepicker model. Just pass the datepicker as the last argument.
For example:
@docs clearDates, toggleCalendar, cancelDates, previousMonth, nextMonth, receiveDate
```Elm
newDatepicker = DatePicker.setDate date datepicker
```
Or
```Elm
newDatePicker = DatePicker.clearDates datepicker
```
@docs clearDates, toggleCalendar, cancelDates, previousMonth, nextMonth, setDate
-}

Expand Down Expand Up @@ -557,3 +569,10 @@ nextMonth =
receiveDate : Cmd Msg
receiveDate =
Task.perform ReceiveDate Date.now


{-| Manually set the selected date
-}
setDate : Date -> DatePicker -> DatePicker
setDate date =
update (SelectDate (Just date))

0 comments on commit e94ea17

Please sign in to comment.