Home

Awesome

Vue Datetime Picker

Build Status

Fast, powerful and easy to use component datetime picker for VueJS. The component includes localization, highlight and disable date, 12/24-hour time, inline mode, etc.

Demo

See demo here

vue-datetime-picker

Requirements

Usage

npm install vue-vanilla-datetime-picker --save
import DateTimePicker from 'vue-vanilla-datetime-picker';

Vue.component('date-time-picker', DateTimePicker);
@import "node_modules/vue-vanilla-datetime-picker/dist/DateTimePicker"

Props:

NameRequiredTypeDefaultDescription
v-model, value*String, Date, DateTime (luxon)Value
value-formatStringyyyy-LL-dd HH:mm:ssValue format
max-dateString, Date, DateTime (luxon)nullMax date
min-dateString, Date, DateTime (luxon)nullMin date
constraints-formatStringyyyy-LL-ddConstraints format
localeStringenSet locale.
inlineBooleanfalseEnable inline mode.
disabledBooleanfalseDisable datetime picker.
formatStringyyyy-LL-dd HH:mmDisplay format.
time-pickerBooleantrueShow time picker.
hour-timeNumber24Hour in 12/24-hour time. Values: '12', '24'.
no-toggle-time-pickerBooleanfalseNo toggle time picker button.
only-time-pickerBooleanfalseShow only time picker.
start-from-sundayBooleanfalseSet Sunday as first day of week.
minute-stepNumber1Set step for minute.
seconds-pickerBooleanfalseShow second picker.
initial-viewStringdaysInitial view: 'days', 'months', 'years'
initial-view-dateString, Date, DateTime (luxon)daysInitial date view
main-button-classStringClass for main button.
disabled-datesArray[]Array of disabled dates.
highlightedArray[]Array of highlighted dates. Example: [{ date: '2018-09-17', class: 'highlighted' }]
auto-closeBooleanfalseClose date picker after select date.
clear-buttonBooleanfalseShow "Clear" button.
close-buttonBooleanfalseShow "Close" button.
today-buttonBooleanfalseShow "Today" button.
value-typeStringAutoSet value type. Types: 'Auto', 'String', 'Date', 'Luxon'.
empty-valueAny''Set empty value for clear button.

Slots:

NameDescription
choose-dateFor main button if date not selected.
formatted-datetimeFor main button if date selected.
dateFor date button.
timeFor time button.
months-prevFor previous month button.
months-nextFor next month button.
years-prevFor previous year button.
years-nextFor next year button.
decades-prevFor previous decade button.
decades-prevFor next decade button.
hours-upFor hours up button.
hours-downFor hours down button.
minutes-upFor minutes up button.
minutes-downFor minutes down button.
seconds-upFor seconds up button.
seconds-downFor seconds down button.
meridiems-upFor meridiems up button.
meridiems-downFor meridiems down button.
clearFor clear button.
closeFor close button.
todayFor today button.

Events:

Name
close
open
change-month
change-year
change-decade

Methods:

NameDescription
openOpen datetime picker
closeClose datetime picker

What about RTL support?

If you need an RTL version of component for your project, recommend use PostCSS plugin which is called postcss-rtl.

Development

npm install

Compiles and hot-reloads for development

npm run serve

Compiles and minifies for production

npm run build-lib