primefaces / primevue

Next Generation Vue UI Component Library
https://primevue.org
MIT License
10.2k stars 1.21k forks source link

DatePicker: View "year" throws error on year selection #6028

Closed tibramo closed 1 month ago

tibramo commented 3 months ago

Describe the bug

The DatePicker with view "year", as in https://primevue.org/datepicker/#yearpicker, throws the following error upon year selection:

ReferenceError: value is not defined
    at Proxy.isYearSelected (DatePicker.ca76d316.js:358:8960)
    at year (DatePicker.ca76d316.js:358:2021)
    at Go (entry.8d61df7a.js:36:124976)
    at Dm (entry.8d61df7a.js:36:125192)
    at Proxy._getOptionValue (BaseComponent.54c219ea.js:1:4811)
    at Proxy.cx (BaseComponent.54c219ea.js:1:6791)
    at DatePicker.ca76d316.js:370:14830
    at Kv (entry.8d61df7a.js:16:11375)
    at DatePicker.ca76d316.js:370:14698
    at Object.r [as default] (entry.8d61df7a.js:16:3695)

After encountering this error, you cannot open the DatePicker again unless you manually clear the input field.

There seems to be a pull request to fix this: https://github.com/primefaces/primevue/pull/5986

Reproducer

https://stackblitz.com/edit/nsj4av?file=src%2FApp.vue

PrimeVue version

4.0.0

Vue version

4.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

  1. Click on the input field
  2. Select a year

Expected behavior

No response

VictorBalbo commented 3 months ago

The PR does look like it fixes the problem

sandivsv commented 3 months ago

I have also a same issue but one error is more when this (1st image) error come after that if we select any date then that time it gives a contineos loop of vue warning in console like (2nd img) , to remove this we have to only refresh 1st image image

2nd image image

HozSensei commented 2 months ago

I've the same probleme : image

If i initialise my model with new Date() i have error. If i don t define my model, everything is ok.

gustavobmichel commented 2 months ago

This is a fundamental bug that can be easily reproduced by going to the datepicker page and selecting a value. If you try to click on the year you will be prompted with the error above.

https://github.com/user-attachments/assets/2b4ee5a9-90ea-488d-8e31-3d083f0de1be

Given there's a PR to try and address it, is it possible to include in the upcoming versions? Thanks!

Ancient-Dragon commented 2 months ago

@tugcekucukoglu please could you take a look at this bug, the open PR seems to fix the issue. Would be great to get it in a 4.0.2 release

gustavobmichel commented 2 months ago

I know this workaround might not work for everyone, but we have disabled the year selection via a css rule.

.p-datepicker-select-year {
  pointer-events: none;
}

We are working very hard to upgrade to PrimeVue 4 and having to rework the theme system so this will unblock us for now until we have a fix.

rodriguez-ae commented 2 months ago

Hi, Allan here! I'm from Guatemala and I'm working with the government as tech lead, currently we have the same problem specifically with the "Only Year Picker", Do you have any update about this issue? Thanks you so much.

alegMINTRAB commented 2 months ago

I agree with Rodriguez Ae. Currently we are working on a platform that relies on a PrimeVue frontend. And this is currently an on going issue with different projects at the Government.

djuarezJS commented 2 months ago

Hi, I urgently need to use the date picker only in Years if we could get an update on the issue it would be great.

MynorSaban commented 2 months ago

We are developing a platform with PrimeVue and have encountered the same issue with the "Only Year Picker"

dinacuatro commented 2 months ago

Have exactly the same problem, also need urgently the date picker to work in years mode, any due-date for fixing this bug?

djuarezJS commented 2 months ago

Have exactly the same problem, also need urgently the date picker to work in years mode, any due-date for fixing this bug?

hello i did this to make it work for the moment it has date format "yy" and the view is in month.

image

Ancient-Dragon commented 2 months ago

@cagataycivici not sure if @tugcekucukoglu is away but please could we get this looked at? There is a PR with a fix that is ready for merging which would help a lot of us out!

tugcekucukoglu commented 1 month ago

https://github.com/primefaces/primevue/issues/6203