This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
1.0.0 1.0.1
A user interface for selecting dates
version 1.0.2
license BSD3
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 1.0.2
Committed At 2016-11-04 04:28:37 UTC
justinmimbs/elm-date-extra 2.0.1 <= v < 3.0.0 2.1.1
elm-lang/html 2.0.0 <= v < 3.0.0 2.0.0
elm-lang/core 5.0.0 <= v < 6.0.0 5.1.1

README

elm-date-selector

The DateSelector view displays a familiar calendar for selecting a date, but allows a user to select the year, month, and day independently. This allows for quick selection of a date without changing modes or stepping through calendars one month at a time.

The core view is provided in the DateSelector module, and a dropdown view is available in DateSelectorDropdown. Both modules expose only view functions. Because there is little data to manage, how you store and update the data is up to you.

DateSelector

DateSelector

The DateSelector.view function takes only Date values (for the minimum, maximum, and selected dates; a side-effect of the UI design is that no "internal" state is needed) and creates Html that produces Date messages. You can map its Date messages to your own message type.

type Msg = SelectDate Date | ...

view : Html Msg
view =
  DateSelector.view minDate maxDate (Just selectedDate)
    |> Html.map SelectDate

DateSelectorDropdown

DateSelectorDropdown

The DateSelectorDropdown.view function creates a button and a DateSelector view when it's open. You must provide a Bool indicating whether or not the dropdown is open, as well as constructors for the messages you want to receive when a user toggles the dropdown and when they select a date.

The DateSelectorDropdown.viewWithButton function allows you to use your own button with the dropdown. See the docs and the examples listed below for more detail.

Examples

  1. Standalone DateSelector / source
  2. DateSelectorDropdown / source
  3. DateSelectorDropdown with custom button / source
  4. Multiple DateSelectorDropdowns / source

CSS

The styles are available as a CSS file here. This file does not declare a font-family, and all sizes are specified in em units, allowing font styles to be inherited. Similarly, the default button for DateSelectorDropdown.view is an unstyled <input>, allowing its look to be inherited.