mengxiong10 / vue-datepicker-next

A datepicker / datetimepicker component for Vue3
https://mengxiong10.github.io/vue-datepicker-next/
MIT License
147 stars 34 forks source link

Possibility to set max diff between range calendars #14

Closed MskHelen17 closed 2 years ago

MskHelen17 commented 2 years ago

Hello! In the vue2-datepicker package there is a possibility to set max difference between calendars in range mode:

Datepicker.CalendarRange.computed.calendarMaxDiff = function () {
    return 1;
};

As a result, when I scroll through, for example, the left calendar, the right one is scrolled simultaneously with it. And the difference between them is always 1 month. This is very convenient for me

There is no such computed property in vue3 version of CalendarRange file anymore. And I haven't found another way to achieve this behavior.

It would be great if such an opportunity appeared in the package for vue3. Thank you in advance!

mengxiong10 commented 2 years ago

The recommended way is to use a prop calendar.

<date-picker :calendar="calendar" @calendar-change="handleCalendarChange" />
data() {
  return {
     caledar: [new Date(), new Date()]
  }
},
methods: {
   handleCalendarChange(dates, index) {
     // update dates
     .....
     this.calendar = dates
   }
}
MskHelen17 commented 2 years ago

Yes, everything worked out with calendar prop. Thanks!

theDevelopper commented 2 years ago

Can you add this prop to the documentation?