2.5.2 • Published 5 years ago

@tillhub/vue-date-picker v2.5.2

Weekly downloads
68
License
-
Repository
-
Last release
5 years ago

@tillhub/vue-date-picker CircleCI

A date picker that allows user to select a range, quick pick dates, and select custom ranges

Install

npm install --save @tillhub/vue-date-picker

Demo

npm run serve

Usage

<template>
  <vue-date-picker
    locale="de"
    tintColor="#357ebd"
    buttonLabel="All Time"
    buttonWidth="auto"
    :hideDateInButton="false"
    :showTime="false"
    :initCustomToggle="true"
    @get-dates="printTheDate"/>
</template>

<script>

import VueDatePicker from '@tillhub/vue-date-picker'
import '@tillhub/vue-date-picker/dist/vue-date-picker.css'

export default {
  name: 'App',
  components: {
    VueDatePicker
  },
  methods: {
    printTheDate(selected){
      console.log("I gots the dates! ", selected)
    }
  },
}
</script>

Properties

The components accepts optional properties.

Propertytyperequiredexampledefaultdescription
localestringno"de" or "en""en"Currently only German and English is supported. Only 'de' and 'en '
tint-colorstringno"#50e3c1""#357ebd"This allows customized color of the highlighted date range on the calender
placementstringnorightbottomThe side of the button that the date picker will open from
button-labelstringno"All Time""Select"Customized Button Label to override default
button-widthstringno"100px""auto"Overrides the button width, but default it adjust to content
date-typestringno"iso" or "date""date"Formats the get-dates (start/end) to either date format or ISO string format
date-formatstringno"yyyy-MM-dd"noneA valid date-fns token to format the dates instead of defaulting to the native toLocaleDateString. For the list of tokens see: https://date-fns.org/v2.9.0/docs/format
:hide-date-in-buttonbooleannotruefalseOverrides the applied date being showed in place of Button label
:show-timebooleannofalsetrueOverrides the time being shown next to the date
:init=custom-togglebooleannofalsetrueActivates or de-activate Custom toggle at the bottom on initial open
:simplebooleannotruefalseThis will only have the date-range calender select options
:clearablebooleannotruefalseAn X icon will appear on the button that will clear date and return {} on @get-dates
:date-rangeobjectno{ start: new Date(), end: "2018-11-13T23:00:00.000Z", showDateText: true }trueAllows the date-range to be past in. The object must include a 'start' and 'end' key with a date value or an ISO sting. 'showDateText' (optional) must be a boolean and will over ride the button label and message above the calender to be the date range. It defaults to false
:default-short-cutstringno"thisMonth"falseA valid shortcut string that matched with the existing date shortcuts, i.e. today, thisWeek, thisMonth, etc.

Event

The Date picker with only return the selected date from the component when the Applied button is clicked. It will return an object { start: new Date(), end: new Date()} with a start and an end key. The dates will be in a javascript date object see https://www.w3schools.com/js/js_dates.asp.

Eventtypeexampledefaultdescription
@get-datesfunction(selected dates)=>{}n/aPasses the selected dates when the applied button is clicked and will return an object { start: new Date(), end: new Date(), showDateText: true}
@clearfunction()=>{}n/aWhen 'clearable' props is true, this event emits when the clear x is clicked

License

MIT © jmy-kellogg

2.5.2

5 years ago

2.5.1

5 years ago

2.5.0

5 years ago

2.4.2

5 years ago

2.4.1

5 years ago

2.4.0

5 years ago

2.3.0

5 years ago

2.2.1

5 years ago

2.2.0

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.12.0

6 years ago

1.11.0

6 years ago

1.10.0

6 years ago

1.9.0

6 years ago

1.8.0

6 years ago

1.7.0

7 years ago

1.6.0

7 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago

0.1.0

7 years ago