stephenreddek / elm-time-picker / TimePicker

A time picker in pure elm.

Models


type alias Time =
{ hours : Basics.Int
, minutes : Basics.Int
, seconds : Basics.Int 
}

The base way to represent time. Hours are always counted in 24-hour format with midnight at 0


type TimePicker

The base model for the time picker


type alias Settings =
{ showHours : Basics.Bool
, showMinutes : Basics.Bool
, showSeconds : Basics.Bool
, use24Hours : Basics.Bool
, placeholder : String
, hourStep : Basics.Int
, minuteStep : Basics.Int
, secondStep : Basics.Int
, disabled : Basics.Bool
, hideDisabledOptions : Basics.Bool
, isHourDisabled : Basics.Int -> Basics.Bool
, isMinuteDisabled : Basics.Int -> Basics.Bool
, isSecondDisabled : Basics.Int -> Basics.Bool
, isPeriodDisabled : Period -> Basics.Bool 
}

Contains the configuration that doesn't need to be maintained by the library.


type Period
    = AM
    | PM

Period denotes whether its AM or PM when using 12-hour format

defaultSettings : Settings

The basic configuration for a TimePicker

selectedTime : TimePicker -> Maybe Time

Returns the current value of the time picker

Update

init : Maybe Time -> TimePicker

Function for initializing a closed and empty TimePicker


type Msg

The internal messages that the picker uses to operate


type TimeEvent
    = NoChange
    | Changed (Maybe Time)

Used to communicate to the caller that the value has been set, changed, or cleared.

update : Settings -> Msg -> TimePicker -> ( TimePicker, TimeEvent )

Function to update the model when messages come

View

view : Settings -> TimePicker -> Html Msg

Function for viewing the time picker