mercurymedia/elm-datetime-picker/11.1.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.

List (Attribute msg)
-> Settings
-> Posix
-> Maybe Posix
-> Maybe Posix
-> DatePicker msg
-> Html msg

The duration date inputs view with the date picker opening on click. Pass it the configured settings, the base time, the picked start and end times and the date picker instance you wish to view.

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

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

String
-> Settings
-> Posix
-> Maybe Posix
-> Maybe Posix
-> DatePicker msg
-> ( DatePicker msg, Cmd 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.

updatePickerPosition : DatePicker msg -> ( DatePicker msg, Cmd msg )

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

hasError : Settings -> DatePicker msg -> Bool

Indicates whether the DatePicker's date inputs have a validation error