mercurymedia/elm-datetime-picker/10.0.1

NOTE: the latest version is 12.0.1

SingleDatePicker

A date picker component for a single datetime.

Architecture

type DatePicker msg

The opaque type representing a particular date picker instance.

type Msg

Internal Msg's to update the picker.

init : (Msg -> msg) -> DatePicker msg

Instantiates and returns a date picker.

view : Settings -> DatePicker msg -> Html msg

The date picker view. Simply pass it the configured settings and the date picker instance you wish to view.

update : Settings -> Msg -> DatePicker msg -> ( DatePicker msg, Maybe Posix )

Update the SingleDatePicker according to the given internal msg.

Returns the updated picker and the currently selected datetime, if available.

subscriptions : Settings -> DatePicker msg -> Sub msg

Events external to the picker to which it is subscribed.

Externally Triggered Actions

openPicker : Settings -> Posix -> Maybe Posix -> DatePicker msg -> DatePicker msg

Open the provided date picker and receive the updated picker instance. Also takes a default time the picker should center on (in the event a time has not yet been picked) as well as the picked time. A common example of a default time would be the datetime for the current day.

Close the provided date picker and receive the updated picker instance.

String
-> Settings
-> Posix
-> Maybe Posix
-> DatePicker msg
-> ( DatePicker msg, Cmd msg )

Open the provided date picker outside the DOM hierarchy. Uses the openPicker function and additionally takes an id of the trigger DOM element (e.g. a button) to manually attach the picker's position to it. Returns the updated picker instance plus the necessary command in order to find DOM elements and their positions.

Returns the command to update the trigger & picker DOM elements' instances. Is used internally but can also be used externally in case of a changing viewport (e.g. onScroll or onResize).

Query

isOpen : DatePicker msg -> Bool

Indicates whether the DatePicker is open