goilluminate/elm-fancy-daterangepicker/1.0.3

NOTE: the latest version is 7.0.0

Rerouted (fork, needs approval). The original repository is gone. This copy comes from a fork that still has the tag. The Lamdera package server serves a copy recovered from https://github.com/hulufei/elm-fancy-daterangepicker (a fork).

What we checked: The original repo or its tag is gone; tag 1.0.3 is on the fork https://github.com/hulufei/elm-fancy-daterangepicker; its commit 0c6aa8309490 is from 2018-10-02 13:32 UTC, before the version was published (2018-10-02 13:33 UTC); elm.json differs from package.elm-lang.org's; the exposed modules match docs.json; the zip's SHA-1 is not the published one and nothing else confirms its contents.

We could not verify this copy against what was published, so the Lamdera compiler asks before using it (y/n). Without a terminal, as in CI, it stops with an error unless approved:

  • lamdera make --auto-approve-package-rerouting approves rerouted versions for that run,
  • LAMDERA_AUTO_APPROVE_PACKAGE_REROUTING=1 does the same for every run in that environment,
  • LAMDERA_CACHE=off skips the Lamdera package server altogether: packages come from package.elm-lang.org and GitHub only, as with elm, and a rerouted version then fails to download.

Details · package.elm-lang.org's zip: https://github.com/goilluminate/elm-fancy-daterangepicker/zipball/1.0.3/

DateRangePicker

A customizable daterangepicker component.

type Msg

A type representing messages that are passed within the DateRangePicker.

The DateRangePicker model.

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

The daterangepicker update function.

Expose if the daterange picker is open

Sets the the open state of the DateRangePicker

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

getDateRange : DateRangePicker -> Maybe DateRange

Expose the current selected daterange.

Sets the current daterange for the daterangepicker.

Settings

type alias Settings =
{ placeholder : String
, inputName : Maybe String
, inputId : Maybe String
, inputIcon : Maybe (Html Msg)
, inputAttributes : List (Attribute Msg)
, presetOptions : PresetOptions
, restrictedDateRange : RestrictedDateRange
, formatDateRange : DateRange -> String
}

The settings that the DateRangePicker uses.

defaultSettings : Settings

A record of default settings for the daterangepicker.

Sets the settings for the daterange picker

setDateRangeFormat : (DateRange -> String) -> DateRangePicker -> DateRangePicker

Sets the date range formatter for the daterangepicker.

Sets the placeholder for the daterangepicker.

Sets the name for the daterangepicker.

Sets the id for the daterangepicker.

Sets the input icon for the daterangepicker.

Sets the input attributes for the daterangepicker.

Sets the preset options for the daterangepicker.

Sets the restricted date range for the daterangepicker.

formatDateRange : DateRange -> String

A function that formats a daterange to a string.

getMinDate : DateRangePicker -> Maybe Date

Expose the min date in the enabled date range.

getMaxDate : DateRangePicker -> Maybe Date

Expose the max date in the enabled date range.

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
, dateRange : DateRange
}

A type that represents a preset daterange.

  • name = Name of the preset. i.e. "Past Month"
  • dateRange = The daterange 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 = "Past Month"
, interval = Months
, presetRelativeToday = ToToday
, 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.
= ToToday
| FromToday

A type representing how the preset is relative to today.

  • If using ToToday, the preset daterange would use today as the end date, and the date from your PresetSettings as the end date.
  • If using FromToday, the preset daterange would use today as the start date and the date from your PresetSettings as the end date.
defaultPresetOptions : PresetOptions

A record of default preset options for the daterangepicker.

defaultPresets : Date -> List Preset

An opaque function used to make the default presets

mkPresetFromDateRange : String -> DateRange -> Preset

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

mkPresetFromDates : String -> Date -> Date -> Preset

A function that creates a Preset from a name, startDate, and endDate

getPresets : DateRangePicker -> List Preset

Expose the current presets.