Renamed to n1k0/elm-daterange-picker. It is published under that name, and new versions come out there.
Versions published as allo-media/elm-daterange-picker still install under that name. 8 versions of 8 come from the new location (see their notes).
Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/n1k0/elm-daterange-picker.
What we checked: The repo moved to github.com/n1k0/elm-daterange-picker. Rebuilt with git archive from commit 086326e71c26 of https://github.com/n1k0/elm-daterange-picker (zip prefix allo-media-elm-daterange-picker-086326e/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 c37b739014ce86a80df9ed5ac53326c8d3ecdfd3.
The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.
Details · package.elm-lang.org's zip: https://github.com/allo-media/elm-daterange-picker/zipball/4.0.0/
A date range picker widget.
import Browser
import DateRangePicker as Picker
import Html exposing (Html, text)
type alias Model =
{ picker : Picker.State }
type Msg
= PickerChanged Picker.State
init : () -> ( Model, Cmd Msg )
init _ =
let
picker =
Picker.init Picker.defaultConfig Nothing
in
( { picker = picker }
, Picker.now PickerChanged picker
)
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
PickerChanged state ->
( { model | picker = state }, Cmd.none )
view : Model -> Html Msg
view model =
Picker.view PickerChanged model.picker
main =
Browser.element
{ init = init
, update = update
, view = view
, subscriptions = .picker >> Picker.subscriptions PickerChanged
}A Config featuring the following default values:
allowFuture: TrueapplyRangeImmediately: Trueclass: ""inputClass: ""monthFormatter: Converts month names to their 3 chars English equivalent: Jan, Feb, etc.noRangeCaption: "N/A"predefinedRanges: "Today", "Yesterday", "Last 7 days", "Last 30 days", "This month" and "Last month"sticky: FalseweekdayFormatter: Converts weekday names to their 2 chars English equivalent: Mo, Tu, etc.weeksStartOn: Time.Mon (weeks start on Monday)Helper to selectively alter defaultConfig:
configure (\default -> { default | weeksStartOn = Time.Sun })
|> init NothingReconfigure a date range picker State.
state |> reconfigure (\current -> { current | weeksStartOn = Time.Sun })DateRangePicker state.
Use helpers to set or retrieve values out of it.
Checks if the date range picker State is currently disabled.
Open or close a date range picker State.
Note: inoperant when the sticky option is True.
Checks if the date range picker State is currently opened.
Note: always returns True when the sticky config option is enabled.
The main DateRangePicker view.
The first argument is tipycally one of your application Msg, which will receive
a new State each time it's changed:
import DateRangePicker as Picker
type alias Model =
{ picker : Picker.State }
type Msg
= PickerChanged Picker.State
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
PickerChanged state ->
{ model | picker = state }
view : Model -> Html Msg
view model =
Picker.view PickerChanged model.pickerDateRangePicker subscriptions. They're useful if you want an opened date range picker panel to be closed when clicking outside of it.
DateRangePicker configuration:
allowFuture: Allow picking a range in the futureapplyRangeImmediately: Apply predefined range immediately when clickedclass: CSS class name(s) to add to the component root element.inputClass: CSS class name(s) to add to the component text input.monthFormatter: How to format aTime.MonthnoRangeCaption: The String to render when no range is setpredefinedRanges: Generates custom predefined ranges.sticky: Make the picker always openedweekdayFormatter: How to format aTime.WeekdayweeksStartOn: TheTime.Weekdayweeks start on (eg.Time.MonorTime.Sun)zone: A userTime.Zoneto compute relative datetimes against (default:Time.utc)