Skip to content

Month range picker doesn't trigger rangeStart rangeEnd events properly #1005

Closed
@jllavec

Description

@jllavec

Describe the bug
Hi,

When I'm using Month picker with range selection and I select first January 2023 and then February 2023, event flow works properly.

January 2023 triggers rangeStart and February 2023 triggers rangeEnd.

But when I select them in the opposite way it doesn't work properly.

If I select first February 2023, it triggers rangeStart and if I select then January 2023, it triggers rangeStart again but twice.
The first trigger I receive the date I selected as end of range, and in second trigger I receive as parameter the date i selected as start of range.

I don't think this is intended behavior, since with dates picker, it works properly in both ways.

To Reproduce

Repro stackblitz: https://stackblitz.com/edit/vuepic-vue-datepicker-b6kbyg?file=src%2Fcomponents%2FPlayground.vue
Steps to reproduce the behavior:

  1. Open datepicker as month picker (in repro stackblitz the first one)
  2. Select February 2024
  3. Check that rangeStart trigger worked properly
  4. Select January 2024
  5. Check that rangeEnd doesn't trigger but rangeStart triggers twice

Expected behavior
I expect that Month Picker triggers rangeStart and rangeEnd events without taking in count the order I select the dates (as it works in Dates Picker).
It should trigger rangeStart when I select the first date, and then rangeEnd when I select the other date for the range, regardless it's sooner or later than the first one I selected.

Screenshots
If applicable, add screenshots to help explain your problem.

Working properly selecting in order January-February
bien

Unexpected behavior selecting in opposite order February-January
mal

Desktop & mobile (please complete the following information):

  • Browser [e.g. chrome, safari]: Chrome 129.0.6668.70 / Firefox 130.0.1
  • Library version [e.g. 3.0.0]: 9.0.3

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