Date and time widgets

Every date, range, duration and recurrence widget installed on this site, built from the real field widget plugins rather than rebuilt by hand -- a date widget is rarely one element, and copying it would be copying the thing under test. Core's date, range, datelist and timestamp widgets; the recurring ones from Date Recur and its four modular rewrites of the same rule; Smart Date, which thinks in durations rather than end times, shown a second time filled in, with its settings changed and with recurring rules; Duration Field and Interval, which store a length with no start; and the pickers from Flatpickr, Duet, Single Date Time and Datetime Range Popup. The field definitions are made up on the spot, so no fields need to exist and nothing is saved. A widget whose module is not installed is left out rather than shown broken.

A single date and time

The plainest date field there is, and six ways to enter it. Every one of them stores the same string; what changes is how much of the picker is markup the theme owns, and how much is drawn by the browser where nothing can reach it.

datetime_default

Core. A date input beside a time input, both native: the pickers are the ones the operating system draws, so there is nothing in the DOM to theme and no two platforms look alike.

Date

datetime_datelist

Core. The same value as a row of selects -- year, month, day, hour, minute -- which is the fallback for wanting one rendering everywhere. It is the widest of the single-date widgets and the one most likely to break a narrow column.

Date

Smart Date

A range that thinks in durations rather than in end times, on the grounds that an author knows an event runs for an hour more readily than they know it ends at 14:30. The module carries its own field type as well as its own widgets, so it shares nothing with the range widgets above.

smartdate_default

Smart Date. A start, a duration and an end that keep each other in step: changing any two rewrites the third, in the browser. The duration is a select of the usual lengths with a custom option behind it.

When

Start

End

smartdate_inline

The same widget laid out along one line, which is what it has to look like inside a paragraph or a table rather than down a form.

When

Start

to

End

smartdate_only

A range of whole days: two dates, with the times and the duration left out.

When

Start

to

End

smartdate_datelist

The select-list rendering, for the same reason the core datelist exists.

When

Start

End

smartdate_timezone

The full widget with a timezone select on the end, for events whose timezone is part of the value rather than a property of the site.

When

Start

to

End

Smart Date, configured and filled in

The same widgets with their settings moved off the defaults, and with a value in them. Empty, a Smart Date widget hides most of what it does: the duration only means something once there is a start, the end date is only shown once it differs from the start, and the times only fold away once "All day" is ticked. The dates are fixed rather than counted from today, so the page looks the same on every visit and in every screenshot. The settings each widget is built with are listed under its note.

smartdate_default

A ninety-minute meeting. The duration select takes its value from the two times, and the end date stays hidden because it is the day the meeting starts.

When

Start

End

smartdate_default

A whole day, which Smart Date stores as midnight to 23:59 and reads back as "All day" ticked, with the times hidden.

When

Start

End

smartdate_default

A three-day conference. The length is in no list, so the duration falls to "Custom". With hide_date off the end date is shown whatever it holds, and with duration_overlay off the duration stays a select rather than turning into a list of end times under the end.

  • hide_date: false
  • duration_overlay: false
When

Start

End

smartdate_inline

The inline widget with a separator of its own and without the "All day" checkbox, for a field that is always a time of day.

  • separator: until
  • allday: false
When

Start

until

End

smartdate_default

A booking slot: a start and a length out of a short list with no custom option behind it. With nothing custom to fall back to, the end date and time are made read-only and only ever follow from the start and the length.

  • default_duration: 30
  • default_duration_increments: 15, 30, 45, 60|1 hour
When

Start

End

smartdate_only

A five-day holiday in the date-only widget, stored as midnight on the first day to 23:59 on the last.

When

Start

to

End

smartdate_datelist

Two days in the select lists, in month, day, year order.

  • date_order: MDY
When

Start

End

smartdate_timezone

An evening in Berlin, stored in Berlin time: the select shows the zone of the value rather than the default of the site, and the times are the ones on the clock there.

When

Start

to

End

smartdate_inline

Three values in a field that allows any number: the table of a multi-value widget, with a drag handle and a Remove button on every row. The inline widget is the one usually put there, and this is the layout the drag gutter of the theme is drawn for.

  • cardinality: unlimited

When

Order
When (value 1)

Start

to

End

When (value 2)

Start

to

End

When (value 3)

Start

to

End

Smart Date, recurring

Smart Date Recurring adds a rule under the dates -- "every two weeks on Monday and Wednesday, ten times" -- made of selects, numbers and checkboxes rather than typed as an RRULE. The module only offers it on fields that allow any number of values, so every field here does. The rules are filled in the way the widget fills them from a saved one, but nothing is saved, so the "Manage Instances" button a saved rule puts beside the widget is missing.

smartdate_default

A value that does not repeat: "never" in the frequency select, and the rest of the rule hidden behind it.

  • cardinality: unlimited
  • allow_recurring: true

When

Order
When (value 1)

Start

End

times
on days
Choose hours to include
Leave empty to allow repeating at any hour.
Choose minutes to include
Leave empty to allow repeating at any value.

smartdate_default

Every two weeks on Monday and Wednesday, ten times. An interval or a day opens the advanced options, where the days are a row of checkboxes.

  • cardinality: unlimited
  • allow_recurring: true

When

Order
When (value 1)

Start

End

times
Advanced
on days
Choose hours to include
Leave empty to allow repeating at any hour.
Choose minutes to include
Leave empty to allow repeating at any value.

smartdate_inline

The last Friday of every month until the end of the year, in the inline widget, with the frequencies cut down to weekly and monthly in the widget settings. A monthly rule names its day with a pair of selects rather than the checkboxes.

  • allowed_recur_freq_values: WEEKLY, MONTHLY
  • cardinality: unlimited
  • allow_recurring: true

When

Order
When (value 1)

Start

to

End

times
Advanced
on days
Choose hours to include
Leave empty to allow repeating at any hour.
Choose minutes to include
Leave empty to allow repeating at any value.

smartdate_default

A half-hour slot every hour of the working day, on weekdays, with no end. Restricting the hours opens the grid of hour checkboxes, which makes this the largest the widget gets.

  • allowed_recur_freq_values: HOURLY, DAILY, WEEKLY
  • cardinality: unlimited
  • allow_recurring: true

When

Order
When (value 1)

Start

End

times
Advanced
on days
Restrict to Specific Hours
Choose hours to include
Leave empty to allow repeating at any hour.
Choose minutes to include
Leave empty to allow repeating at any value.

smartdate_inline

Two values in one field, one of them repeating: the multi-value table with a rule in one row and not in the other.

  • cardinality: unlimited
  • allow_recurring: true

When

Order
When (value 1)

Start

to

End

times
on days
Choose hours to include
Leave empty to allow repeating at any hour.
Choose minutes to include
Leave empty to allow repeating at any value.
When (value 2)

Start

to

End

times
on days
Choose hours to include
Leave empty to allow repeating at any hour.
Choose minutes to include
Leave empty to allow repeating at any value.

A timestamp

An integer rather than a formatted string, which is what core stores its own dates as.

datetime_timestamp

Core. What the authored-on field of a node form uses: one date and time pair over an integer column.

Date

Leave blank to use the time of form submission.