Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date Picker: A bug with selecting a year #6110

Open
limbitskiy opened this issue Jul 25, 2024 · 1 comment
Open

Date Picker: A bug with selecting a year #6110

limbitskiy opened this issue Jul 25, 2024 · 1 comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@limbitskiy
Copy link

Describe the bug

There's a bug in this function:

isYearSelected(year) {
            if (!this.isComparable()) return false;

            if (this.isMultipleSelection()) {
                return this.modelValue.some((currentValue) => currentValue.getFullYear() === year);
            } else if (this.isRangeSelection()) {
                const start = this.modelValue[0] ? this.modelValue[0].getFullYear() : null;
                const end = this.modelValue[1] ? this.modelValue[1].getFullYear() : null;

                return start === year || end === year || (start < year && end > year);
            } else {
                return value.getFullYear() === year; // **<--- such variable 'value' doesn't exist**
            }
        },

Line 749 at this time.
You can see the bug even in official documentation if you select a date and then try to select a different year in the dropdown:
https://primevue.org/datepicker/#inline

Reproducer

https://stackblitz.com/edit/primevue-4-vite-issue-template-hjhpyh?file=src%2FApp.vue

PrimeVue version

4.0.0

Vue version

4.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

Chrome 126

Steps to reproduce the behavior

  1. Visit docs: https://primevue.org/datepicker/#inline
  2. Select a date
  3. Try to select a year

Expected behavior

No response

@limbitskiy limbitskiy added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jul 25, 2024
@Ancient-Dragon
Copy link
Contributor

Duplicate of: #6028

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

2 participants