A simple Vue.js datepicker component. Supports disabling of dates, translations
npm install simple-vue-datepickerDerived and stripped down from https://github.com/charliekassel/vuejs-datepicker
A datepicker Vue component. Compatible with Vue 2.x
N.B. - this is in a very raw intermediate state and is not meant for general public consumption at this point. I'm working on another project and will be cleaning this up over time but for now:
1. it's not tested except for my specific use cases
2. the documentation is inaccurate - it has not been scrubbed
3. it's only partially stripped down - there are lots of relics
`` bash`
$ npm install simple-vue-datepicker --save` javascript
import Datepicker from 'simple-vue-datepicker';
Vue.component('my-component', {
components: {
Datepicker
}
});
`
` html`
value prop sets the selectedDate. should be a Date object. defaults to null - no date selected.
` html`
Use v-model for two-way binding` html`
Emits events
Some of these might still work
` html``
Inline always open version html`Available props
| Prop | Type | Default | Description |
|-----------------------|--------------|-------------|------------------------------------------|
| value | Date/String | | Date value of the datepicker |
| language | String | en | Translation for days and months |
| disabled | Object | | See below for configuration |
| inline | Boolean | | To show the datepicker always open |
| initialViewDate | Date/String | value | Year/month to initially show on calendar |
| mondayFirst | Boolean | false | Show Monday as first day of week |
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 |
| cleared | | Selected date has been cleared|
#### Disabled Dates
Dates can disabled in a number of ways.
` html`
#### Highlight Dates
Dates can be highlighted (e.g. for marking an appointment) in a number of ways. Important: You can only highlight dates that aren't disabled.
Note: Both to and from properties are required to define a range of dates to highlight
` html`
#### Translations
Contributing guide - please use appropriate code from this list as the translation property.
` html``
Available languages
| Abbr | Language | |
| ----------- |------------------|----------|
| ar | Arabic | |
| bg | Bulgarian | |
| bs | Bosnian | |
| cs | Czech | |
| da | Danish | |
| de | German | |
| ee | Estonian | |
| en | English | Default|
| es | Spanish | |
| fi | Finnish | |
| fr | French | |
| he | Hebrew | |
| hu | Hungarian | |
| hr | Croatian | |
| id | Indonesian | |
| is | Icelandic | |
| it | Italian | |
| ja | Japanese | |
| ko | Korean | |
| lt | Lithuanian | |
| nb-no | Norwegian Bokmål | |
| nl | Dutch | |
| pl | Polish | |
| pt-br | Portuguese-Brazil| |
| ro | Romanian | |
| ru | Russian | |
| sk | Slovak | |
| sl-si | Slovenian | |
| sv | Swedish | |
| th | Thai | |
| tr | Turkish | |
| uk | Ukrainian | |
| vi | Vietnamese | |
| zh | Chinese | |