vue-month-picker is a lightweight, dependency-free month picker component designed specifically for Vue 3 applications. Currently at version 2.0.0, it offers robust functionality for selecting single months or month ranges without external dependencies, making it a highly performant choice. The library features full TypeScript support, leveraging Vue's Composition API and `<script setup>` syntax for modern Vue development. Key capabilities include inline and input-driven picker modes, date constraints (`minDate`, `maxDate`), customizable date formatting, a dark theme option, year-only selection, and extensive internationalization with over 45 built-in languages. Its focus on Vue 3 and zero dependencies differentiates it from more general-purpose date pickers.
npm install vue-month-pickerVerified import paths — ran on the pinned version, not inferred.
Demonstrates local component registration for both inline and input-driven month pickers, including basic usage with event handling and range selection.
Ensure your project is using Vue 3 (version 3.0.0 or higher). For Vue 2 projects, seek alternative month picker libraries or upgrade your Vue version.
When creating Date objects for `minDate`/`maxDate`, subtract 1 from the month number (e.g., `new Date(2024, 0, 1)` for January). For `default-month`, use the standard 1-12 month number.
To start with no selection, use only 'no-default'. To provide an initial selection, omit 'no-default' and set 'default-month' and 'default-year' as desired.
Ensure you have either imported the component locally (e.g., `import { MonthPicker } from 'vue-month-picker'`) and added it to your component's `components` option (or `<script setup>`), or globally registered the plugin (`app.use(VueMonthPicker)`).Add conditional rendering or null checks before accessing properties of the date object returned by the component (e.g., `<p v-if="date">{{ date.month }}</p>`). This is especially relevant when using the `no-default` prop.