{% extends "base.html" %} {% import "components/macros.html" as ui %} {% block title %}Date & Time Pickers - Design System Wiki{% endblock %} {% block content %}
Custom popup calendars and hour/minute scroll menus constructed using DOM components to prevent relying on native browser-system calendar windows. Designed for optimal styling consistency.
The custom date picker relies on the following classes and datasets to manage month navigation and update values:
| Selector / Class | Type | Behavior & Purpose |
|---|---|---|
| .custom-datepicker | Class |
Wraps the date picker component. Must declare data-year (e.g. 2026) and data-month (0-indexed, 0 = Jan, 4 = May) to initialize the viewport.
|
| .datepicker-value | Class |
Hidden input field (<input type="hidden">) storing the ISO date value (YYYY-MM-DD) for form submission.
|
| .datepicker-trigger | Class | Button clicked by user to open or close the calendar popover dropdown. |
| .datepicker-text | Class | Target text element updated dynamically to display the formatted selected date (e.g., "May 30, 2026"). |
| .datepicker-popover | Class |
Floating container containing the month navigation buttons and days grids. Starts as hidden.
|
| .datepicker-prev / .datepicker-next | Class | Navigational buttons to decrement or increment the active month. |
| .datepicker-month-year | Class | Clickable header button. Toggles view grid modes between days selection, months selection, and years selection. |
| .datepicker-days | Class | Calendar day grid container dynamically populated with clickable day buttons by the JS engine. |
The custom time picker scopes dynamic lists of hours and minutes inside scrollable blocks using the following bindings:
| Selector / Class | Type | Behavior & Purpose |
|---|---|---|
| .custom-timepicker | Class | Wraps the time picker markup structure. |
| .timepicker-value | Class | Hidden input field storing the active text time (e.g. "12:00 PM") for forms. |
| .timepicker-trigger | Class | Clickable button to open the scroll dropdown. |
| .timepicker-text | Class | Text node inside trigger displaying the formatted time. |
| .timepicker-popover | Class | Dropdown overlay panel displaying columns for hour list, minute list, and AM/PM buttons. |
| .timepicker-col-hours / .timepicker-col-minutes | Class | Containers populated automatically with hourly buttons (1-12) and minute buttons (00-55). |
| .timepicker-ampm-btn | Class | Buttons representing "AM" and "PM" choices toggled on click. |
You can customize the styling of the trigger buttons, chevrons, icons, popover cards, borders, shadows, backgrounds, and the active option buttons (which receive .bg-indigo-600). Ensure you preserve the classes and attributes listed above so the DOM-generation functions and trigger listeners in components.js execute without error.