datepicker - 渲染一个用于选择日期和时间的文本字段。
published_at:
label: Published
type: datepicker
mode: date以下字段属性受支持且常用。
| Property | Description |
|---|---|
| label | a name when displaying the form field to the user. |
| default | specifies a default string value, optional. |
| comment | places a descriptive comment below the field. |
| mode | the expected result, either date, datetime or time. Default: datetime. |
| format | provide an explicit date display format. Eg: Y-m-d |
| minDate | the minimum/earliest date that can be selected. |
| maxDate | the maximum/latest date that can be selected. |
| yearRange | number of years to show either side, or an array of upper/lower range, example [1900,2015]. Default: 10. |
| disableDays | days that cannot be selected, can be a number to represent Sunday (0) to Saturday (6), or a specific date (2024-10-01). |
| firstDay | the first day of the week. Default: 0 (Sunday). |
| twelveHour | display a 12-hour clock for selecting time. Default: false |
| hoursOnly | allows for selecting hours only while selecting time. Default: false |
| showWeekNumber | show week numbers at head of row. Default: false |
| useTimezone | convert the date and time from the backend specified timezone preference. |
使用 time 模式来显示时间选择器,并通过 twelveHour 属性切换 24 小时制或 12 小时制显示。
birth_time:
label: Time Born
type: datepicker
mode: time
twelveHour: true为了简化时间选择,请使用 hoursOnly 模式来呈现小时选择,不包含分钟.
birth_hour:
label: Hour Born
type: datepicker
mode: time
hoursOnly: truedisableDays 属性可用于禁用特定日期的选择。
booking_date:
label: Booking Date
type: datepicker
mode: date
disableDays:
- 0 # Sundays
- 6 # Saturdays
- "2023-08-10" # Specific date该 disableDays 属性也可以设置为一个静态 PHP 函数,用于动态设置禁用日期。
booking_date:
type: datepicker
disableDays: App\Classes\BookingManager::getDisabledBookingDates