1.1.0 • Published 1 year ago

vue2-inline-calendar v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Vue2 Inline Calendar

The simple, functional inline calendar component for Vue2 (version for Vue3 is in development now) based on Intersection Observer API — just drag and scroll to get future and past dates.

Installation

npm i vue2-inline-calendar -S

or

yarn add vue2-inline-calendar

Usage

<template>
    <div id="app">
        <vue-inline-calendar @select-date="selectedDate = $event" />
    </div>
</template>

<script>
import VueInlineCalendar from 'vue2-inline-calendar'

export default {
  name: 'App',
  components: {
    VueInlineCalendar
  },
  data() {
    return {
      selectedDate: null
    }
  },
}
</script>

Available props

Prop nameDescriptionTypeDefault value
initialDateInitial selected dateDatenull
initialRangeInitial selected range of datesDatenull
daysRangeNumber of days, which will be loaded on scrollNumber7
itemWidthWidth of date element (.date-item)Number80
itemsGapDistance between date elementsNumber10
localeA string with a BCP 47 language tagString"en-US"
scrollSpeedSpeed of dates scrollNumber4
disableWeekendsExcluding weekends from selectionBooleanfalse
specMinDateMinimum allowed dateDatenull
specMaxDateMaximum allowed dateDatenull
disablePastDaysExcluding dates before today's date from selectionBooleanfalse
disableNextDaysExcluding dates after today's date from selectionBooleanfalse
isRangeSetting up range mode — selection of start and end datesBooleanfalse
showYearShowing of the current year (pass false, if you want to hide the year)Booleantrue
showMonthShowing of the date's month (pass false, if you want to hide the month)Booleantrue
showWeekdayShowing of the date's weekend (pass false, if you want to hide the weekend)Booleantrue
enableMousewheelScrollEnabling of the calendar scrolling when using the mousewheelBooleanfalse

Available events

Event nameDescriptionPayload
select-dateFires on date selectionSelected date (instance of Date object)
select-dates-rangeFires on date range selection (when endDate is selected)Object with startDate and endDate keys and dates as values: {startDate: this.startDate, endDate: this.endDate }

License

MIT License

Support the author

If you would like to support me and my work, you can make a donation via Buy Me a Coffee (link at the section Sponsor this project) or with cryptocurrency:

PlatformAddress
Bitcoinbc1q0rygfalnctew4cla3ed9wfw2pv0uh4r0eyfuag
Ethereum/Tether USDT (TRC20)0x38b3822213c6BDCc01eF770442F5BF0842AB740f
Litecoinltc1qdgs0jult63k6ggjzaedh3er2z7w70aktl5j2wu