abadi199/datetimepicker/6.0.1

NOTE: this package is not compatible with Elm 0.19.1

DateTimePicker

DateTime Picker

Picking date and time

(State -> Maybe Date -> msg)
-> List (Attribute msg)
-> State
-> Maybe Date
-> Html msg

Date and Time Picker view with default configuration Example: type alias Model = { dateTimePickerState : DateTimePicker.State, value : Maybe DateType }

type Msg
    = DatePickerChanged DateTimePicker.State (Maybe Date)


view =
    DateTimePicker.dateTimePicker
        DatePickerChanged
        [ class "my-datetimepicker" ]
        model.dateTimePickerState
        model.value
Config
(CssConfig (DatePickerConfig TimePickerConfig) msg CssClasses)
msg
-> List (Attribute msg)
-> State
-> Maybe Date
-> Html msg

Date and Time Picker view with custom configuration Example: type alias Model = { dateTimePickerState : DateTimePicker.State, value : Maybe Date }

type Msg
    = DatePickerChanged DateTimePicker.State (Maybe Date)


customConfig =
    let
        default =
            DateTimePicker.defaultDateTimePickerConfig DatePickerChanged
    in
    { default
        | firstDayOfWeek = Date.Mon
        , autoClose = True
    }


view =
    DateTimePicker.dateTimePickerWithConfig
        customConfig
        [ class "my-datetimepicker" ]
        model.dateTimePickerState
        model.value

Picking dates

(State -> Maybe Date -> msg)
-> List (Attribute msg)
-> State
-> Maybe Date
-> Html msg

Date Picker view function with default configuration.

Example: type alias Model = { datePickerState : DateTimePicker.State, value : Maybe Date }

type Msg
    = DatePickerChanged DateTimePicker.State (Maybe Date)


view =
    DateTimePicker.datePicker
        DatePickerChanged
        [ class "my-datepicker" ]
        model.datePickerState
        model.value
Config (CssConfig (DatePickerConfig {}) msg CssClasses) msg
-> List (Attribute msg)
-> State
-> Maybe Date
-> Html msg

Date Picker view function with custom configuration.

Example: type alias Model = { datePickerState : DateTimePicker.State, value : Maybe Date }

type Msg
    = DatePickerChanged DateTimePicker.State (Maybe Date)


customConfig =
    let
        default =
            DateTimePicker.defaultConfig DatePickerChanged
    in
    { default
        | firstDayOfWeek = Date.Mon
        , autoClose = True
    }


view =
    DateTimePicker.datePickerWithConfig
        customConfig
        DateTimePicker.defaultDatePickerConfig
        [ class "my-datepicker" ]
        model.datePickerState
        model.value

Picking times

(State -> Maybe Date -> msg)
-> List (Attribute msg)
-> State
-> Maybe Date
-> Html msg

Time Picker view with default configuration Example: type alias Model = { timePickerState : DateTimePicker.State, value : Maybe DateType }

type Msg
    = TimePickerChanged DateTimePicker.State (Maybe Date)


view =
    DateTimePicker.timePicker
        TimePickerChanged
        [ class "my-timepicker" ]
        model.timePickerState
        model.value
Config (CssConfig TimePickerConfig msg CssClasses) msg
-> List (Attribute msg)
-> State
-> Maybe Date
-> Html msg

Time Picker view with custom configuration Example: type alias Model = { timePickerState : DateTimePicker.State, value : Maybe Date }

type Msg
    = TimePickerChanged DateTimePicker.State (Maybe Date)


customConfig =
    let
        default =
            DateTimePicker.defaultTimePickerConfig TimePickerChanged
    in
    { default
        | autoClose = True
    }


view =
    DateTimePicker.timePickerWithConfig
        customConfig
        [ class "my-datetimepicker" ]
        model.timePickerState
        model.value

Initial

initialState : State

Initial state of the DatePicker

initialStateWithToday : Date -> State

Initial state of the DatePicker with today Date

initialCmd : (State -> Maybe Date -> msg) -> State -> Cmd msg

Initial Cmd to set the initial month to be displayed in the datepicker to the current month.

Internal State

type alias State =
InternalState

The state of the date time picker (for Internal Use)