goilluminate/elm-fancy-daterangepicker/6.0.0

NOTE: the latest version is 7.0.0

Rerouted (cache, needs approval). The original is gone. This copy comes from a Lamdera package cache made before it went. The Lamdera package server serves a copy recovered from a Lamdera package cache from 2021-02-13.

What we checked: Rebuilt from the unpacked sources in a Lamdera package cache (5 copies agree), which Elm only writes after the published SHA-1 checked out; elm.json differs from package.elm-lang.org's; the exposed modules match docs.json; the zip is our own, so its SHA-1 is not the published one.

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/6.0.0/

DateRangePicker

A customizable daterangepicker component.

type Msg

A type representing msgs that are fired from the update function.

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.

Subscribes to a mouse click

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.

Expose today's date.

= FullCalendar
| ThreeMonths
| TwoMonths
| OneMonth

A type representing how the calendar will be displayed

  • FullCalendar = the datepicker displays all 12 months when open
  • ThreeMonths = the datepicker displays 3 months at a time
  • TwoMonths = the datepicker displays 2 months at a time
  • OneMonth = the datepicker displays 1 month at a time
type alias DateRange =
DateRange

A type representing a date range with a start date and end date.

= Off
| ToPresent
| FromPresent
| Past
| Future
| Between Date Date
| To Date
| From Date

A type representing a restricted range for the datepicker. All dates not within the restricted date range will be disabled.

  • Off = no restrictions, any date to any date can be chosen.
  • ToPresent = from any date in the past up to today (including today)
  • FromPresent = from today to any date in the future
  • Past = from any date in the past up to yesterday (excluding today)
  • Future = from tomorrow up to any date in the future
  • Between date date = only between the two given dates [start - end] (inclusive)
  • To date = from any date in the past up to the given date (inclusive)
  • From date = from the given date up to any date in the future (inclusive)
daysInRange : DateRange -> Int

A function that returns the number of days as a whole number in the daterange

inRange : Date -> DateRange -> Bool

A function to check if a given date is within a given dateRange.

mkDateRange : Date -> Date -> DateRange

A function that creates a DateRange by taking in two dates (start and end). This function assumes that start <= end

An opaque function that makes the EnabledDateRange from settings.

EnabledDateRange is Nothing if RestrictedDateRange is Off

monthAbbr : Month -> String

A function that formats a Month into the abbreviated string.

  • Ex. Jan -> "Jan"
monthsInRange : DateRange -> Int

A function that returns the number of months as a whole number in the daterange

Sets whether range selection is disabled for the daterangepicker.

startOfQuarter : Date -> Date

A function that takes a Date and returns the date representing the first date of the quarter that the passed in date belongs to.

weeksInRange : DateRange -> Int

A function that returns the number of weeks as a whole number in the daterange

yearsInRange : DateRange -> Int

A function that returns the number of years as a whole number in the daterange

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
, calendarDisplay : CalendarDisplay
, inputView : Maybe (String -> List (Html Msg))
, disableRange : Bool
}

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 inputText 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.

Sets the CalendarDisplay for the daterangepicker

Maybe (String -> List (Html Msg))

Sets the inputView function 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
, dateRange : DateRange
, presetDateOption : PresetType
}

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 -> PresetType -> Preset

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

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

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

getPresets : DateRangePicker -> List Preset

Expose the current presets.

= Today
| Yesterday
| PastWeek
| PastMonth
| PastYear
| WeeksFromToday Int
| MonthsFromToday Int
| EndOfTime
| NoneSelected

A type that can be used for calculating relative presets outside of the daterangepicker.

defaultSingleSelectPresets : Date -> List Preset

An opaque function used to make the default presets

Expose the currently selected preset.