goilluminate/elm-fancy-daterangepicker/5.1.3

NOTE: the latest version is 7.0.0

Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: github.com/goilluminate/elm-fancy-daterangepicker is gone (deleted or private); Software Heritage has not archived the repo; no fork with tag 5.1.3 found (2 same-name repos checked); no cached copy. Use another version.

Details

DatePicker

A customizable daterangepicker component.

type Msg

A type representing messages that are passed within the DatePicker.

The DatePicker model.

init : ( DatePicker, Cmd Msg )

The default initial state of the DatePicker. You must execute the returned command in order to set the current date and for the datepicker to behave correctly.

The datepicker update function.

Subscribes to a mouse click

isOpen : DatePicker -> Bool

Expose if the daterange picker is open

Sets the the open state of the DatePicker

view : DatePicker -> Html Msg

The daterange picker view. The date range passed is whatever date range it should treat as selected.

getDate : DatePicker -> Maybe Date

Expose the current selected date.

setDate : Maybe Date -> DatePicker -> DatePicker

Sets the current date for the datepicker.

Expose today's date.

Settings

type alias Settings =
{ placeholder : String
, inputName : Maybe String
, inputId : Maybe String
, inputIcon : Maybe (Html Msg)
, inputAttributes : List (Attribute Msg)
, presetOptions : PresetOptions
, restrictedDateRange : RestrictedDateRange
, formatDate : Date -> String
, calendarDisplay : CalendarDisplay
, inputView : Maybe (String -> List (Html Msg))
, showPresetsTab : Bool
}

The settings that the DatePicker uses.

defaultSettings : Settings

A record of default settings for the datepicker.

Sets the settings for the daterange picker

setDateFormat : (Date -> String) -> DatePicker -> DatePicker

Sets the date formatter for the datepicker.

Sets the placeholder for the datepicker.

Sets the name for the datepicker.

setInputText : Maybe String -> DatePicker -> DatePicker

Sets the input text for the datepicker.

Sets the id for the datepicker.

Sets the input icon for the datepicker.

setInputAttributes : List (Attribute Msg) -> DatePicker -> DatePicker

Sets the input attributes for the datepicker.

setPresetOptions : PresetOptions -> DatePicker -> DatePicker

Sets the preset options for the datepicker.

Sets the restricted date range for the datepicker.

Sets the CalendarDisplay for the datepicker

setInputView : Maybe (String -> List (Html Msg)) -> DatePicker -> DatePicker

Sets the inputView function for the datepicker

Sets the showPresetsTab option for the datepicker

Presets

type alias PresetOptions =
{ presetOption : PresetOption
, presetSettings : List PresetSetting
, presets : List Preset
}

A type representing your preset options for your date range picker.

= DefaultPresets
| CustomPresetsFromSettings
| CustomPresets
| CustomOnly
| AllPresets
| NoPresets

A type representing which presets to use.

  • DefaultPresets = Use the default presets from defaultPresets only.
  • CustomPresetsFromSettings = Use only your custom built presets from a list of PresetSetting only.
  • CustomPresets = Use only your custom built Presets.
  • CustomOnly = Use only your custom build presets build from PresetSetting and your custom presets.
  • AllPresets = Use all presets (default, customFromSettings, custom).
  • NoPresets = Turn off Presets.
type alias Preset =
{ name : String
, date : Date
}

A type that represents a preset date.

  • name = Name of the preset. i.e. "Past Month"
  • date = The date that is selected when selecting the preset.
type alias PresetSetting =
{ name : String
, interval : PresetInterval
, presetRelativeToToday : PresetRelativeToToday
, value : Int
}

A type used to generate preset dateranges.

  • name = The name that you want to give the preset. i.e. "Past Month"
  • interval = The interval in which you want to add/subtract the value from today.
  • presetRelativeToToday = whether it is a range from [past - present] (ToToday) or [present - future] (FromToday)
  • value = the number of your @interval that you are adding/subtracting.

Example

{ name = "1 Month Ago"
, interval = Months
, presetRelativeToday = BeforeToday
, value = 1
}
= Days
| Months
| Years

A type representing what the value in PresetSettings is measured in.

  • Ex. value = 1 and PresetInterval = Days, this is interpretted as 1 Days.
  • Ex. value = 4 and PresetI:nterval = Months, this is interpretted as 4 Months.
= BeforeToday
| AfterToday
| Today
| Tomorrow
| Yesterday

A type representing how the preset is relative to today.

  • BeforeToday will subtract any value from today and use that date.
  • AfterToday will add any value form today and use that date.
  • Today will use today.
  • Tomorrow will use tomorrow.
  • Yesterday will use yesterday.
defaultPresetOptions : PresetOptions

A record of default preset options for the datepicker.

defaultPresets : Date -> List Preset

An opaque function used to make the default presets

mkPresetFromDate : String -> Date -> Preset

A function that creates a Preset from a name and a date

getPresets : DatePicker -> List Preset

Expose the current presets.