NoRedInk/datetimepicker-legacy/1.0.1

NOTE: the latest version is 3.1.0

DateTimePicker

DateTime Picker

type alias DateTime =
DateTime

The representation of a date and time in the picker

dateTime : Int -> Month -> Int -> Int -> Int -> DateTime

Construct a DateTime

View

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

Date Picker view function with default configuration.

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

type Msg
    = DatePickerChanged DateTimePicker.State (Maybe DateTime.DateTime)


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

Date Picker view function with custom configuration.

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

type Msg
    = DatePickerChanged DateTimePicker.State (Maybe DateTime.DateTime)


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
(State -> Maybe DateTime -> msg)
-> List (Attribute msg)
-> State
-> Maybe DateTime
-> 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 DateTime.DateTime)


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

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

type Msg
    = DatePickerChanged DateTimePicker.State (Maybe DateTime.DateTime)


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


view =
    DateTimePicker.dateTimePickerWithConfig
        customConfig
        [ class "my-datetimepicker" ]
        model.dateTimePickerState
        model.value
(State -> Maybe DateTime -> msg)
-> List (Attribute msg)
-> State
-> Maybe DateTime
-> Html msg

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

type Msg
    = TimePickerChanged DateTimePicker.State (Maybe DateTime.DateTime)


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

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

type Msg
    = TimePickerChanged DateTimePicker.State (Maybe DateTime.DateTime)


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


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

Initial

initialStateWithToday : DateTime -> State

Initial state of the DatePicker with today Date

Internal State

type alias State =
InternalState

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