NoRedInk/datetimepicker-legacy/1.0.5

NOTE: the latest version is 3.1.0

DateTimePicker.Config

DateTimePicker configuration

Configuration

type alias Config otherConfig msg =
{ otherConfig
| onChange : State -> Maybe DateTime -> msg
, autoClose : Bool
, usePicker : Bool
, attributes : List (Attribute msg)
, fromInput : String -> Maybe DateTime
, toInput : DateTime -> String
}

Configuration

  • onChange is the message for when the selected value and internal State in the date picker has changed.
  • autoClose is a flag to indicate whether the dialog should be automatically closed when a date and/or time is selected.
  • parseInput accepts a user string from the input element and attempts to convert it to a DateTime
type alias DatePickerConfig otherConfig =
{ otherConfig
| nameOfDays : NameOfDays
, firstDayOfWeek : Weekday
, allowYearNavigation : Bool
, earliestDate : Maybe DateTime
}

Configuration for the DatePicker

  • nameOfDays is the configuration for name of days in a week.
  • firstDayOfWeek is the first day of the week.
  • allowYearNavigation show/hide year navigation button.
  • earliestDate if given, dates before this cannot be selected
type alias TimePickerConfig =
{ timePickerType : TimePickerType }

Configuration for TimePicker

  • timePickerType is the type of the time picker, either Analog or Digital
type alias NameOfDays =
{ sunday : String
, monday : String
, tuesday : String
, wednesday : String
, thursday : String
, friday : String
, saturday : String
}

Configuration for name of days in a week.

This will be displayed as the calendar's header. Default:

  • sunday = "Su"
  • monday = "Mo"
  • tuesday = "Tu"
  • wednesday = "We"
  • thursday = "Th"
  • friday = "Fr"
  • saturday = "Sa"
= Digital
| Analog

The type of time picker, can be either Digital or Analog

type Type msg
= DateType (Config (DatePickerConfig {}) msg)
| DateTimeType (Config (DatePickerConfig TimePickerConfig) msg)
| TimeType (Config TimePickerConfig msg)

The type of picker (for Internal Use)

Default Configuration

defaultDatePickerConfig : (State -> Maybe DateTime -> msg) -> Config (DatePickerConfig {}) msg

Default configuration for DatePicker

  • onChange No Default
  • autoClose Default: True
  • nameOfDays see NameOfDays for the default values.
  • firstDayOfWeek Default: Sunday.
  • allowYearNavigation Default : True
  • earliestDate Default : Nothing
defaultTimePickerConfig : (State -> Maybe DateTime -> msg) -> Config TimePickerConfig msg

Default configuration for TimePicker

  • onChange No Default
  • dateFormatter Default: "%m/%d/%Y"
  • dateTimeFormatter Default: "%m/%d/%Y %I:%M %p"
  • autoClose Default: False
  • timeFormatter Default: "%I:%M %p"
  • timePickerType Default: Analog
(State -> Maybe DateTime -> msg)
-> Config (DatePickerConfig TimePickerConfig) msg

Default configuration for DateTimePicker

  • onChange No Default
  • dateFormatter Default: "%m/%d/%Y"
  • dateTimeFormatter Default: "%m/%d/%Y %I:%M %p"
  • autoClose Default: False
  • nameOfDays see NameOfDays for the default values.
  • firstDayOfWeek Default: Sunday.
  • titleFormatter Default: "%B %Y"
  • fullDateFormatter Default: "%A, %B %d, %Y"
  • timeFormatter Default: "%I:%M %p"
  • timePickerType Default: Analog
  • allowYearNavigation Default : True
  • earliestDate Default : Nothing
defaultDateFromInput : String -> Maybe DateTime

Default date parser

defaultTimeFromInput : String -> Maybe DateTime

Default time parser

defaultDateTimeFromInput : String -> Maybe DateTime

Default date and time parser

defaultDateTimeToInput : DateTime -> String

Default date and time printer

defaultDateToInput : DateTime -> String

Default date printer

defaultTimeToInput : DateTime -> String

Default time printer