<template>
<div>
<Datepicker v-model="date" :range="{ maxRange: 31 }" month-picker />
{{ date }}
</div>
</template>
<script setup>
import { ref } from 'vue';
import Datepicker from '@vuepic/vue-datepicker';
import '@vuepic/vue-datepicker/dist/main.css';
const date = ref();
</script>
Expected behavior
The datepicker should disallow selecting months which are further apart then the maxRange specified.
The calculation here is a bit ambiguous, a naive implementation would be to just calculate the days between the 1st of the starting month and the 1st of the ending month, but there is an argument to be made for 1st of starting month and last of ending month or even changing the intepretation of the maxRange parameter in month-picker mode, such that months are expected instead of days.
Either is fine for me, it just needs to be documented.
Screenshots
Desktop & mobile (please complete the following information):
Browser: Tested with chrome and firefox but probably all browsers.
Describe the bug When using
month-picker
together withmaxRange
the selection does not respect the setmaxRange
.To Reproduce Stackblitz: https://stackblitz.com/edit/vuepic-vue-datepicker-prpkaq?file=src%2Fcomponents%2FPlayground.vue
Code:
Expected behavior The datepicker should disallow selecting months which are further apart then the
maxRange
specified. The calculation here is a bit ambiguous, a naive implementation would be to just calculate the days between the 1st of the starting month and the 1st of the ending month, but there is an argument to be made for 1st of starting month and last of ending month or even changing the intepretation of themaxRange
parameter inmonth-picker
mode, such that months are expected instead of days. Either is fine for me, it just needs to be documented.Screenshots
Desktop & mobile (please complete the following information):