DateTimepicker
Vue Bootstrap 5 DateTimepicker
DateTimepicker is a form that adds the function of selecting date and time without the necessity of using custom JavaScript code.
Note: Read the API tab to find all available options and advanced customization
Basic example
Inline version
You can use inline version with property inline
.
Disabled
Disable past
Use disablePast
prop to disallow selecting past dates.
Disable future
Use disableFuture
prop to disallow selecting future dates.
Default values
You can set default date and time with properties defaultDate
and
defaultTime
.
Invalid label
Add invalidLabel
or validLabel
with specified value, to change the validation label messages.
Input toggle
Add inputToggle
to the picker component to enable toggling on
input click. It is also possible to set toggleButton
property to
false
to remove the toggle button.
Custom date and time options
Use datepicker
or timepicker
properties to set custom options from our
Datepicker and Timepicker components.
Datepicker options
Timepicker options
DateTimepicker - API
Import
Properties
Name | Type | Default | Description |
---|---|---|---|
container
|
String | 'body' |
Allows to change the container for the modal. Container prop should be a valid selector of element that is mounted before the Teleport happens. |
datepicker |
Object | {} |
Allows to set datepicker options. |
dateFormat |
String | 'DD/MM/YYYY' |
Changes date format displayed in input. |
dateTimeSeparator |
String | ',' |
Changes separator between date and time. |
defaultDate |
String|Date|Number | - |
Allows to set default date. |
defaultTime
|
String|Date|Number | - |
Allows to set default time. |
disabled
|
Boolean | false |
Set a disabled attribute to input in wrapper. |
disablePast
|
Boolean | false |
Use to disallow selecting past dates and time. |
disableFuture
|
Boolean | false |
Use to disallow selecting future dates and time. |
icon |
Boolean | true |
Enables icon on DateTimepicker input element |
iconClass |
String | 'far fa-calendar fa-sm' |
Changes icon displayed on DateTimepicker input element |
id
|
String | 'MDBInput-random id' |
Sets id on DateTimepicker input element |
inline
|
Boolean | false |
Allows to use a inline version of datetimepicker. |
inputToggle
|
Boolean | false |
Enables toggling picker on input click |
invalidLabel
|
String | 'Invalid date format' |
Allows to set the value of invalid label. |
isValid
|
Boolean |
|
Allows to set validity value of the date. Requires :isValidated="true" to works |
isValidated
|
Boolean |
|
Allows for external date validation with isValid property |
label
|
String | '' |
Sets label on DateTimepicker input element |
timepicker
|
Object | - |
Allows to set timepicker options. |
toggleButton
|
Boolean | true |
Allows to remove the picker toggle button |
v-model |
String | '' |
Returns current picked date and time |
Methods
Name | Description | Example |
---|---|---|
open |
Manually opens a DateTimepicker |
pickerRef.open()
|
close |
Manually closes a DateTimepicker |
pickerRef.close()
|
Events
Name | Description |
---|---|
close
|
This event fires immediately when the DateTimepicker is closed. |
open
|
This event fires immediately when the DateTimepicker is opened. |
update:modelValue
|
This event fires immediately when the DateTimepicker value is changed. |
update:isValid
|
This event fires immediately when the DateTimepicker valid value is changed |
update:isValidated
|
This event fires immediately when the DateTimepicker validation value is changed |