goilluminate/elm-fancy-daterangepicker/3.2.0

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 3.2.0 is on the fork https://github.com/hulufei/elm-fancy-daterangepicker; its commit d600a0bae13d is from 2019-01-07 17:46 UTC, before the version was published (2019-01-07 17:48 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/3.2.0/

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
}

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.

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 daterangepicker

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.