Vuepic / vue-datepicker

Datepicker component for Vue 3
https://vue3datepicker.com
MIT License
1.48k stars 147 forks source link

Using #dp-input slot instead of text-input results in month selector applying wrong month #746

Closed ryan-voitiskis closed 8 months ago

ryan-voitiskis commented 8 months ago

Edit: Original steps to reproduce were incomplete. Wrapping VueDatePicker in a label was required.

<label>
  <VueDatePicker v-model="date">
    <template #dp-input>
      <div>
        {{ date ? date : 'Select date' }}
      </div>
    </template>
  </VueDatePicker>
</label>

This is strange, but easy to work around.

Describe the bug Using #dp-input slot instead of text-input results in month selector applying wrong month (month selected -1 seems to be applied). eg. Clicking Nov selects Oct, and clicking Jan selects Dec of previous year.

To Reproduce

<VueDatePicker v-model="date">
  <template #dp-input>
    <div>
      {{ date ? date : 'Select date' }}
    </div>
  </template>
</VueDatePicker>

Expected behavior Selecting a month selects correct month as it does in this example:

<VueDatePicker
  v-model="date"
  text-input
>
</VueDatePicker>

Desktop & mobile (please complete the following information):