NoRedInk / datetimepicker-legacy / DateTimePicker

This is a heavily-modified version of https://github.com/abadi199/datetimepicker/blob/master/src/DateTimePicker/Svg.elm


type alias DateTime =
DateTime

The representation of a date and time in the picker

dateTime : Basics.Int -> Time.Month -> Basics.Int -> Basics.Int -> Basics.Int -> DateTime

Construct a DateTime

View

datePickerWithConfig : String -> Config Config.DatePickerConfig msg -> List (Nri.Ui.TextInput.V7.Attribute String msg) -> State -> Maybe DateTime -> Html.Styled.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 }

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

dateTimePickerWithConfig : String -> Config Config.DatePickerConfig msg -> List (Nri.Ui.TextInput.V7.Attribute String msg) -> State -> Maybe DateTime -> Html.Styled.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 }

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

timePickerWithConfig : String -> Config {} msg -> List (Nri.Ui.TextInput.V7.Attribute String msg) -> State -> Maybe DateTime -> Html.Styled.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 =
    DateTimePicker.defaultTimePickerConfig TimePickerChanged

view =
    DateTimePicker.timePickerWithConfig "Time picker"
        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)