Datetimepicker
The Datetimepicker input component allow users to select a date and time based on their browser’s locale from a customizable calendar, and type the date directly into the input with full internationalization support. The input opens a simple dropdown/modal for selecting a date, and uses the native datetimepicker for mobile. The component is based on the Datepicker component.
Examples
Base
Inline
To render the component inline instead of a dropdown/modal use the inline
prop.
Footer slot
The component has an additional footer
slot for customization.
Min/Max Datetime
Use the min-datetime
and max-datetime
props to define a limited date range for the user to choose from.
Datetimepicker component
An input with a simple dropdown/modal for selecting a date and time, uses native datetimepicker for mobile.
<o-datetimepicker></o-datetimepicker>
Props
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
active | The active state of the dropdown, use v-model:active to make it two-way binding | boolean | - | false |
creator | Date creator function, default is new Date() | (() => Date) | - | From config: datetimepicker: { |
customValidity | Custom HTML 5 validation error to set on the form control | string | ((currentValue: Date | null , state: ValidityState) => string) | undefined | - | "" |
datepicker | Define props for the underlying datepicker component | DatepickerProps | - | |
desktopModal | Dropdown content is shown into a modal on desktop | boolean | - | From config: datetimepicker: { |
disabled | Same as native disabled | boolean | - | false |
expanded | Makes input full width when inside a grouped or addon field | boolean | - | false |
formatter | Custom function to format a date into a string | ((date: Date ) => string) | undefined | - | From config: datetimepicker: { |
icon | Icon to be shown | string | - | From config: datetimepicker: { |
iconPack | Icon pack to use | string | mdi , fa , fas and any other custom icon pack | From config: datetimepicker: { |
iconRight | Icon to be added on the right side | string | - | From config: datetimepicker: { |
iconRightClickable | Make the icon right clickable | boolean | - | false |
inline | Display datetimepicker inline | boolean | - | false |
locale | Date format locale | string | - | From config: { |
maxDatetime | Max date to select | Date | - | |
minDatetime | Min date to select | Date | - | |
mobileModal | Dropdown content is shown into a modal on mobile | boolean | - | From config: datetimepicker: { |
mobileNative | Enable mobile native input if mobile agent | boolean | - | From config: datetimepicker: { |
v-model | The input value state | Date | - | |
openOnFocus | Open dropdown on focus | boolean | - | From config: datetimepicker: { |
override | Override existing theme classes completely | boolean | - | |
parser | Custom function to parse a string into a date | ((date: string) => Date ) | undefined | - | From config: datetimepicker: { |
placeholder | Input placeholder | string | - | |
position | Position of the dropdown relative to the input | "auto" | "bottom-left" | "bottom-right" | "bottom" | "left" | "right" | "top-left" | "top-right" | "top" | auto , top , bottom , left , right , top-right , top-left , bottom-left , bottom-right | |
readonly | Same as native input readonly | boolean | - | false |
rounded | Makes the input rounded | boolean | - | false |
size | Size of the input control | string | small , medium , large | From config: datetimepicker: { |
teleport | Append the component to another part of the DOM. Set true to append the component to the body.In addition, any CSS selector string or an actual DOM node can be used. | boolean | object | string | - | From config: datetimepicker: { |
timepicker | Define props for the underlying timepicker component | TimepickerProps | - | |
useHtml5Validation | Enable HTML 5 native validation | boolean | - | From config: { |
Events
Event name | Properties | Description |
---|---|---|
change-month | value number - month number | on month change event |
change-year | value number - year number | on year change event |
icon-click | event Event - native event | on icon click event |
icon-right-click | event Event - native event | on icon right click event |
update:model-value | value Date - updated modelValue prop | modelValue prop two-way binding |
update:active | value boolean - updated active prop | active prop two-way binding |
range-start | value Date - range start date | on range start is selected event |
range-end | value Date - range end date | on range end is selected event |
focus | event Event - native event | on input focus event |
blur | event Event - native event | on input blur event |
invalid | event Event - native event | on input invalid event |
Slots
Name | Description | Bindings |
---|---|---|
footer | Define an additional footer |
Class Inspector
Sass variables
Current theme ➜ Bulma
The theme does not have any custom variables for this component.
Current theme ➜ Bootstrap
The theme does not have any custom variables for this component.