Skip to content

MultiDates: deselecting one of 3+ dates breaks time values #1194

@asaada10

Description

@asaada10

Describe the bug
When using multiDates and selecting at least 3 dates, if one of the selected dates is deselected, the hour and minute values become NaN. Afterwards, trying to select another date triggers the following console error:

RangeError: Invalid time value

To Reproduce

  1. Create a Vue component with the following code:
<template>
  <VueDatePicker v-model="date" multiDates />
</template>

<script setup>
import { VueDatePicker } from "@vuepic/vue-datepicker";
import { ref } from "vue";

const date = ref();
</script>
  1. Select 3 or more different dates.
  2. Deselect one of the previously selected dates.
  3. Observe that the hours and minutes are NaN.
  4. Try selecting another date and check the browser console.

Expected behavior
When a date is deselected, the remaining dates should keep valid hour and minute values, and selecting new dates should not produce errors.

Screenshots
Image

Desktop & mobile (please complete the following information):

  • Browser: Brave
  • Library version: 12.0.4

Additional context
This bug occurs only when there are at least 3 selected dates. Selecting or deselecting 1 or 2 dates does not trigger the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions