abradley2/form-elements/4.1.0

NOTE: the latest version is 4.1.2

FormElements.DatePicker

A "Date Picker" control for selecting dates from a calendar-like interface.

Definitions

view : Model -> Props -> Html Msg

The view for displaying the element.

init : Date -> ( Model, Cmd Msg )

Creates the initial model for the element, using an "index date" to determine what starting date the calendar opens up to. This does not have to be Date.today

update : Msg -> Model -> Props -> DatePickerResult

The main function for updating the element in response to Msg

defaultProps : String -> Props

Convenience function for getting a default Props record. Requires that the element's id be passed in.

type Msg
= NoOp
| ToggleShowDatePicker Bool
| GetToday Date
| OnDateSelected Date
| NextMonth Date
| PreviousMonth Date

Messages return from the view

type alias Model =
{ showDatePicker : Bool
, today : Date
, monthMap : MonthMap
, outroMonthMap : Maybe MonthMap
}

The model the element uses to render itself.

type alias Props =
{ id : String
, label : String
, selectedDateDisplay : Date -> String
, selectedDate : Maybe Date
, weekdayDisplay : Weekday -> String
, monthDisplay : Month -> String
, dateIsHighlighted : Date -> Bool
, canSelectDate : Date -> Bool
, canSelectMonth : ( Month, Int ) -> Bool
}

Configurable properties for rendering the view

type alias DatePickerResult =
ComponentResult Model Msg ExternalMsg Never

Alias for the element's Component Result type type.

= DateSelected Date

The external message type for the Component Result type