a11y_datetime is an accessibility-focused fork of flatpickr.
The addon package name stays flatpickr on purpose to keep existing REDAXO installations, installer updates, and project references fully compatible.
Internally, the frontend assets have been migrated to a11y_datetime.
This addon uses the a11y_datetime fork and is no longer a strict visual/behavioral 1:1 clone of original flatpickr in every detail.
Key differences:
- Accessibility-first behavior (ARIA, keyboard flow, live announcements).
- Additional fork options are passed through via
data-*attributes. - Some defaults intentionally differ from original flatpickr.
Examples of changed/new defaults:
focusOpens: defaultfalseannounceChanges: defaulttruemonthYearWheel: defaulttrueshowMonthNavArrows: defaultfalse(arrows are optional)
Website: https://friendsofredaxo.github.io/a11y_datetime/
GitHub: https://github.com/FriendsOfREDAXO/a11y_datetime
Just install it from the REDAXO installer
{"class": "flatpickr","data-locale":"de","data-enableTime":"true"}You can also use the new class name:
{"class": "a11y_datetime","data-locale":"de","data-enableTime":"true"}<input type="date" class="form-control flatpickr" data-locale="de" data-enableTime="true" name="REX_INPUT_VALUE[1]" value="REX_VALUE[1]">Optional: enable opening on focus for a field:
<input type="text" class="form-control a11y_datetime" data-focusOpens="true" name="event_start">{"class": "flatpickr_range","data-locale":"de","data-enableTime":"true", "data-rangefield":"#id"}or
{"class": "a11y_datetime_range","data-locale":"de","data-enableTime":"true", "data-rangefield":"#id"}If you don't want to see the time in a date-field, don't use the timepicker and set an alternative View.
Just set the data-altFormat. 😀
{"class":"flatpickr","data-altFormat":"j. F, Y"}By default, the picker does not open automatically when the input receives focus via Tab. If you want the legacy behavior for a specific field, enable it explicitly:
{"class":"flatpickr","data-focusOpens":"true"}You can pass the new timeRules option as JSON via data-timeRules.
Example: Monday-Friday 08:00-17:00, Saturday 10:00-14:00.
{"class":"flatpickr","data-enableTime":"true","data-timeRules":"[{\"days\":[1,2,3,4,5],\"from\":\"08:00\",\"to\":\"17:00\"},{\"days\":[6],\"from\":\"10:00\",\"to\":\"14:00\"}]"}Note: weekday indices follow JavaScript (0=Sunday, 1=Monday, ..., 6=Saturday).
Important: If data-timeRules is set and a weekday has no matching rule, that weekday becomes not selectable.
In the example above, Sunday (0) is disabled.
You can enable the header month/year wheel per field.
{"class":"flatpickr","data-monthYearWheel":"true","data-yearRange":"{\"past\":10,\"future\":10}","data-yearWheelManualInput":"true"}data-yearRange expects a JSON object with past and future.
You can re-enable header arrows explicitly:
{"class":"flatpickr","data-monthYearWheel":"true","data-showMonthNavArrows":"true"}Show multiple calendar pages side-by-side (useful for ranges):
{"class":"flatpickr_range","data-showMonths":"3","data-rangefield":"#id"}These data-* attributes are supported in addition to classic flatpickr usage:
| Attribute | Option | Type |
|---|---|---|
data-announceChanges |
announceChanges |
true/false |
data-focusOpens |
focusOpens |
true/false |
data-showTitleBar |
showTitleBar |
true/false |
data-showCloseButton |
showCloseButton |
true/false |
data-initialDayFocus |
initialDayFocus |
today/selected/firstAvailable |
data-timeRules |
timeRules |
JSON array |
data-monthYearWheel |
monthYearWheel |
true/false |
data-showMonthNavArrows |
showMonthNavArrows |
true/false |
data-showMonths |
showMonths |
Integer (1, 2, 3, ...) |
data-yearRange |
yearRange |
JSON object {past,future} |
data-yearWheelManualInput |
yearWheelManualInput |
true/false |
You can disable dates via a comma seprated list. The attribute ist data-disabled.
Example:
{"class": "flatpickr","data-locale":"de","data-enableTime":"true", "data-disabled":"2022-12-11,2022-12-24,2022-12-25"}Friends Of REDAXO
Project lead Thomas Skerbis