mercurymedia/elm-datetime-picker/10.0.1

NOTE: the latest version is 12.0.1

DurationDatePicker

A date picker component for picking a datetime range.

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.

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

Update the DurationDatePicker according to the given internal msg.

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

subscriptions : Settings -> DatePicker msg -> Sub msg

Events external to the picker to which it is subscribed.

Externally Triggered Actions

Settings
-> Posix
-> Maybe 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 start and end times. 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
-> 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