icai / vue3-calendar

vue 2.x vue 3.x calendar component
https://icai.github.io/vue3-calendar/
MIT License
494 stars 89 forks source link

How to hide previous months? #30

Closed FrancescoMussi closed 10 months ago

FrancescoMussi commented 6 years ago

Hello. Great component. Just one question:

Is it possible to hide all the months (and years) previous than the current one?

alex2wong commented 6 years ago

or you can simply return the click handler when clicked on month previous than current one. @click="monthSelect(stringifyYearHeader(currDate, pan), $index)" or add a compute function to judge the month is visible or not. <template v-for="(m, $index) in text.months"> <span :key="m" :id="m" :class="{'datepicker-dateRange-item-hidden': isHidden(m)}" ></span></template>

dschinnerl commented 6 years ago

Or you can just disable days for < minDate || > maxDate...

<calendar
  :pane="1"
  :hasInput="false"
  :showDateOnly="true"
  :on-day-click="onDayClick"
  :format="dateFormat"
  :value="dateValue"
  :change-pane="changePane"
  :minDate="'2018-06-01'" <===
  :maxDate="'2019-06-01'" <===
>