Date Picker Field

Date Picker Field

Form Widget

datepicker - renders a text field used for selecting date and times.

published_at:
    label: Published
    type: datepicker
    mode: date

The following field properties are supported and commonly used.

PropertyDescription
labela name when displaying the form field to the user.
defaultspecifies a default string value, optional.
commentplaces a descriptive comment below the field.
modethe expected result, either date, datetime or time. Default: datetime.
formatprovide an explicit date display format. Eg: Y-m-d
minDatethe minimum/earliest date that can be selected.
maxDatethe maximum/latest date that can be selected.
yearRangenumber of years to show either side, or an array of upper/lower range, example [1900,2015]. Default: 10.
disableDaysdays that cannot be selected, can be a number to represent Sunday (0) to Saturday (6), or a specific date (2024-10-01).
firstDaythe first day of the week. Default: 0 (Sunday).
twelveHourdisplay a 12-hour clock for selecting time. Default: false
hoursOnlyallows for selecting hours only while selecting time. Default: false
showWeekNumbershow week numbers at head of row. Default: false
useTimezoneconvert the date and time from the backend specified timezone preference.

Use the time mode to display a time picker and toggle 24-hour or 12-hour display with the twelveHour property.

birth_time:
    label: Time Born
    type: datepicker
    mode: time
    twelveHour: true

For a simplified time selection, use the hoursOnly mode to present hour selection without minutes.

birth_hour:
    label: Hour Born
    type: datepicker
    mode: time
    hoursOnly: true

The disableDays property can be used to disable the selection of specific days.

booking_date:
    label: Booking Date
    type: datepicker
    mode: date
    disableDays:
        - 0 # Sundays
        - 6 # Saturdays
        - "2023-08-10" # Specific date

The disableDays property can also be set to a static PHP function for dynamically setting the disabled days.

booking_date:
    type: datepicker
    disableDays: App\Classes\BookingManager::getDisabledBookingDates
On This Page