PanagiotisGeorgiadis/elm-datepicker/2.1.0

NOTE: the latest version is 4.0.0

DateRangePicker.Types

Contains types that are being used by the parent application in order to initialise a DateRangePicker.

Types

= Single
| Double

The Calendar ViewTypes.

type alias CalendarConfig =
{ today : DateTime
, primaryDate : Maybe DateTime
, dateLimit : DateLimit
, dateRangeOffset : Maybe { minDateRangeLength : Int }
}

Used in order to configure the Calendar part of the DateRangePicker.

  • today: Represents today as DateTime provided by the parent application.

  • primaryDate: Represents the default month - year calendar screen.

    • If the primaryDate is set to Nothing the DateRangePicker will set the primaryDate equal to the today property.

    • If the consumer has provided both a primaryDate and a dateLimit but the primaryDate is out of bounds, the DateRangePicker will set the primaryDate equal to the minium date of the constrains.

  • dateLimit: Used to impose date restrictions on the DateRangePicker. The different configuration settings can be seen on the DateLimit definition.

  • dateRangeOffset: Used to set a minimum length on the selected date range. This basically means that if we set a minimumDateRangeLength of 3, the user will be able to select a minimum of 3 dates.

= DateLimit
{ minDate : DateTime
, maxDate : DateTime
}
| NoLimit

The optional DateRangePicker date restrictions. You can cover most of the date restriction cases with the type below. If by any change you need to achieve a case which is not possible by the current implementation please raise an issue on the repository of this package.

-- A Custom imposed restriction for the year 2019
-- inclusive of the minDate and maxDate.
DateLimit { minDate = 1 Jan 2019, maxDate = 31 Dec 2019 }


-- An unlimited Calendar.
NoLimit
type alias TimePickerConfig =
{ pickerType : PickerType
, defaultTime : Time
, pickerTitles :
{ start : String
, end : String
}
, mirrorTimes : Bool
}

Used in order to configure the TimePicker part of the DateRangePicker.

  • pickerType: Defines the type of the picker as described in the TimePicker module.

  • defaultTime: Defines the defaultTime that will be used as the default value of the TimePicker.

  • pickerTitles: Defines the TimePicker titles.

  • mirrorTimes: Dictates if both the TimePickers should be in sync.         Note: The synchronisation takes place using the onBlur event of the input.