0.4.58 • Published 7 years ago

vuejs-datepicker-string v0.4.58

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Datepicker

npm.io Coverage Status

A datepicker Vue component. Compatible with Vue 1.x and Vue 2.x

Demo

http://www.webpackbin.com/N1vgz1XRb

Install

$ npm install vuejs-datepicker --save
import Datepicker from 'vuejs-datepicker';

Vue.component('my-component', {
    components: {
        Datepicker
    }
});

Usage

<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>

Emits events

<datepicker v-on:selected="doSomethingInParentComponentFunction" v-on:opened="datepickerOpenedFunction">

Inline always open version

<datepicker :inline="true"></datepicker>

Available props

PropTypeDefaultDescription
valueDateDate value of the datepicker
nameStringinput name property
formatStringdd MMM yyyyDate formatting string
languageStringenTranslation for days and months
disabledObjectSee below for configuration
placeholderStringinput placeholder text
inlineBooleanto show the datepicker always open
inputClassStringcss class applied to the input el
wrapperClassStringcss class applied to the outer div
mondayFirstBooleanfalseTo start the week on Monday

Date formatting

NB. This is not very robust at all - use at your own risk! Needs a better implementation.

TokenDescExample
dday1
dd0 prefixed day01
Dabbr dayMon
sudate suffixst, nd, rd
Mmonth number (1 based)1 (for Jan)
MM0 prefixed month01
MMMabbreviated month nameJan
MMMMmonth nameJanuary
yytwo digit year16
yyyyfour digit year2016

Disabled Dates

Dates can disabled in a number of ways.

<script>
var state = {
    disabled: {
        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
        days: [6, 0], // Disable Saturday's and Sunday's
        dates: [ // Disable an array of dates
            new Date(2016, 9, 16),
            new Date(2016, 9, 17),
            new Date(2016, 9, 18)
        ]
    }
}
</script>
<datepicker :disabled="state.disabled"></datepicker>

Translations

<datepicker language="es"></datepicker>

Available languages

AbbrLanguage
enEnglishDefault
esSpanish
fiFinnish
frFrench
hrCroatian
itItalian
nlDutch
deGerman
daDanish
csCzech
pt-brPortuguese-Brazil
viVietnamese
zhChinese
jaJapanese
heHebrew
ruRussian
svSwedish
thThai
0.4.58

7 years ago

0.4.57

7 years ago

0.4.55

7 years ago

0.4.54

7 years ago

0.4.53

7 years ago

0.4.52

7 years ago

0.4.51

7 years ago

0.4.50

7 years ago

0.4.49

7 years ago

0.4.48

7 years ago

0.4.47

7 years ago

0.4.46

7 years ago

0.4.45

7 years ago

0.4.44

7 years ago

0.4.43

7 years ago

0.4.42

7 years ago

0.4.41

7 years ago

0.4.40

7 years ago

0.4.36

7 years ago

0.4.35

7 years ago

0.4.34

7 years ago

0.4.33

7 years ago

0.4.32

7 years ago

0.4.31

7 years ago

0.4.30

7 years ago

0.4.28

7 years ago