Vue CTK Date Time Picker

2.6.1 · active · verified Sun Apr 19

Vue CTK Date Time Picker is a flexible Vue.js component for selecting dates and times, offering both single-date and range selection modes. Its current stable version is 2.6.1. The package maintains an active release cadence, frequently delivering bug fixes and new features, especially since Chronotruck took over its maintenance around version 2.2.0. Key differentiators include built-in dark mode, support for custom shortcuts with callback functions, compatibility with Nuxt.js, locale reactivity, and granular control over disabled dates and keyboard navigation. It is designed to be highly configurable, supporting various date and time formats and offering both ESM/CommonJS and UMD distributions for different project setups.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates the component's setup, showing both single date/time selection and date range selection using `v-model` and a few common props like `label`, `minute-interval`, `range`, and `output-format`.

import { createApp, ref } from 'vue';
import VueCtkDateTimePicker from 'vue-ctk-date-time-picker';
import 'vue-ctk-date-time-picker/dist/vue-ctk-date-time-picker.css';

const app = createApp({
  components: {
    VueCtkDateTimePicker
  },
  setup() {
    const selectedDateTime = ref(null);
    const selectedRange = ref({
      start: null,
      end: null
    });

    return {
      selectedDateTime,
      selectedRange
    };
  },
  template: `
    <div>
      <h2>Single Date/Time Picker</h2>
      <VueCtkDateTimePicker
        v-model="selectedDateTime"
        label="Select Date & Time"
        :minute-interval="15"
      />
      <p>Selected: {{ selectedDateTime }}</p>

      <h2>Range Date/Time Picker</h2>
      <VueCtkDateTimePicker
        v-model="selectedRange"
        :range="true"
        label="Select Date Range"
        output-format="YYYY-MM-DD"
      />
      <p>Start: {{ selectedRange.start }}</p>
      <p>End: {{ selectedRange.end }}</p>
    </div>
  `
});

app.mount('#app');

view raw JSON →