
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
vuejs3-datepicker
Advanced tools
A datepicker Vue component. Compatible with Vue 3 Only
To view demo examples locally clone the repo and run npm install && npm run dev
To view a demo online: https://vuejs3-datepicker.netlify.app/
npm install vuejs3-datepicker --save
yarn add vuejs3-datepicker
import Datepicker from 'vuejs3-datepicker';
export default {
// ...
components: {
Datepicker
}
// ...
}
<datepicker></datepicker>
value prop if passed should be a Date object
<script>
var state = {
date: new Date(2016, 9, 16)
}
</script>
<datepicker :value="state.date"></datepicker>
Support name attribute for normal html form submission
<datepicker :value="state.date" name="uniquename"></datepicker>
Using v-model
<datepicker v-model="state.date" name="uniquename"></datepicker>
Emits events
<datepicker @selected="parentfunctionSelectedhandler" @opened="datepickerOpenedFunction" @closed="parentfunctionCloseHandler">
Inline always open version
<datepicker :inline="true"></datepicker>
Programatic access of datepicker value
<datepicker ref="inputRef" @selected="handleSelectDate" :disabled-dates="disabledDates" :highlighted="highlightDates" :value="date" @closed="handleCalendarClose" ></datepicker>
const { selectedDate } = (inputRef.value as any).value;
Icon color, icon height, icon width of calendar
<datepicker :icon-color="color" :icon-width="width" :icon-height="height" ></datepicker>
Prop | Type | Default | Description |
---|---|---|---|
modelValue | Date|String | Date value of the datepicker via v-model | |
value | Date|String | Date value of the datepicker | |
format | String|Function | dd MMM yyyy | Date formatting string or function |
full-month-name | Boolean | false | To show the full month name |
disabled-dates | Object | See below for configuration | |
placeholder | String | Input placeholder text | |
inline | Boolean | To show the datepicker always open | |
calendar-class | String|Object | CSS class applied to the calendar el | |
input-class | String|Object | CSS class applied to the input el | |
wrapper-class | String|Object | CSS class applied to the outer div | |
monday-first | Boolean | false | To start the week on Monday |
clear-button | Boolean | false | Show an icon for clearing the date |
clear-button-icon | String | Use icon for button (ex: fa fa-times) | |
calendar-button | Boolean | false | Show an icon that that can be clicked |
calendar-button-icon | String | Use icon for button (ex: fa fa-calendar) | |
calendar-button-icon-content | String | Use for material-icons (ex: event) | |
day-cell-content | Function | Use to render custom content in day cell | |
initial-view | String | minimumView | If set, open on that view |
disabled | Boolean | false | If true, disable Datepicker on screen |
typeable | Boolean | false | If true, allow the user to type the date |
use-utc | Boolean | false | use UTC for time calculations |
open-date | Date|String | If set, open on that date | |
minimum-view | String | 'day' | If set, lower-level views won't show |
maximum-view | String | 'year' | If set, higher-level views won't show |
preventDisableDateSelection | Boolean | true | will prevent selection of disabled date |
iconColor | String | black | will change calendar icon color |
iconWidth | String | Number | 16 |
iconHeight | String | Number | 16 |
These events are emitted on actions in the datepicker
Event | Output | Description |
---|---|---|
opened | The picker is opened | |
closed | The picker is closed | |
selected | Date|null | A date has been selected |
input | Date|null | Input value has been modified |
cleared | Selected date has been cleared | |
changed-month | Object | Month page has been changed |
changed-year | Object | Year page has been changed |
changed-decade | Object | Decade page has been changed |
Dates can be disabled in a number of ways.
<script>
var state = {
disabledDates: {
to: new Date(2016, 0, 5), // Disable all dates up to specific date
from: new Date(2016, 0, 26), // Disable all dates after specific date
dates: [ // Disable an array of dates
new Date(2016, 9, 16),
new Date(2016, 9, 17),
new Date(2016, 9, 18)
],
preventDisableDateSelection: true
}
}
</script>
<datepicker :disabled-dates="state.disabledDates" :prevent-disable-date-selection="preventDisableDateSelection"></datepicker>
<script>
var state = {
highlighted: {
to: new Date(2016, 0, 5), // Highlight all dates up to specific date
from: new Date(2016, 0, 26), // Highlight all dates after specific date
dates: [ // Highlight an array of dates
new Date(2016, 9, 16),
new Date(2016, 9, 17),
new Date(2016, 9, 18)
]
},
includeDisabled: true // Highlight disabled dates
}
}
</script>
<datepicker :highlighted="state.highlighted"></datepicker>
new Locale can be added to the following file /src/components/datepicker/locale/index.ts
create a function with new Locale name & export that from data object at the bottom
e.g
const newLocale = (): any => {
const langName = 'Hindi';
const monthFullName = [
'рдЬрдирд╡рд░реА',
'рдлрд╝рд░рд╡рд░реА',
'рдорд╛рд░реНрдЪ',
'рдЕрдкреНрд░реИрд▓',
'рдордИ',
'рдЬреВрди',
'рдЬреБрд▓рд╛рдИ',
'рдЕрдЧрд╕реНрдд',
'рд╕рд┐рддрдВрдмрд░',
'рдЕрдХреНрдЯреВрдмрд░',
'рдирд╡рдВрдмрд░',
'рджрд┐рд╕рдВрдмрд░',
];
const shortName = ['рдЬрди', 'рдлрд╝рд░', 'рдорд╛рд░реНрдЪ', 'рдЕрдкреНрд░реИ', 'рдордИ', 'рдЬреВрди', 'рдЬреБрд▓рд╛', 'рдЕрдЧрд╕реНрдд', 'рд╕рд┐рддрдВ', 'рдЕрдХреНрдЯреВ', 'рдирд╡рдВ', 'рджрд┐рд╕рдВ'];
const days = ['рд░рд╡рд┐', 'рд╕реЛрдо', 'рдордВрдЧрд▓', 'рдмреБрдз', 'рдЧреБрд░реБ', 'рд╢реБрдХреНрд░', 'рд╢рдирд┐'];
const daysNames = ['рд░рд╡рд┐рд╡рд╛рд░', 'рд╕реЛрдорд╡рд╛рд░', 'рдордВрдЧрд▓рд╡рд╛рд░', 'рдмреБрдзрд╡рд╛рд░', 'рдЧреБрд░реБрд╡рд╛рд░', 'рд╢реБрдХреНрд░рд╡рд╛рд░', 'рд╢рдирд┐рд╡рд╛рд░'];
const rtl = false;
const ymd = false;
const yearSuffix = '';
return {
months: monthFullName,
monthsAbbr: shortName,
days,
language: langName,
yearSuffix,
ymd,
rtl,
langName,
daysNames,
};
};
export const data = {
af: af(),
hi: hi(),
de: de(),
en: en(),
fr: fr(),
nl: nl()
...
newLocale: newLocale()
};
Contributors:
FAQs
Vue 3 datepicker
The npm package vuejs3-datepicker receives a total of 4,043 weekly downloads. As such, vuejs3-datepicker popularity was classified as popular.
We found that vuejs3-datepicker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.┬аIt has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600├Ч faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.