primereact icon indicating copy to clipboard operation
primereact copied to clipboard

Calendar: incorrect value is displayed

Open avasuro opened this issue 1 year ago • 0 comments

Describe the bug

If the date in the onChange handler of the Calendar was not updated in external state, the calendar shows incorrect date in date input.

Reproducer

https://codesandbox.io/p/sandbox/primereact-calendar-displays-incorrect-value-if-new-value-was-not-applied-in-onchange-sw2547

System Information

System:
    OS: Windows 11 10.0.22621
    CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-1235U
    Memory: 3.68 GB / 15.71 GB
  Binaries:
    Node: 18.20.3 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    primereact: 10.8.4 => 10.8.4
    react: 18.3.1 => 18.3.1

Steps to reproduce the behavior

  1. Open demo
  2. Click on calendar input and select some date with a mouse
  3. Confirmation dialog will appear - click "No" there

Actual behavior: some date is displayed inside the input Expected behavior: no date should be displayed inside the input

If you click on date input again - date will disappear, as it should be.

Expected behavior

Calendar component should take into account the date provided in props all the time, even if this date wasn't changed

avasuro avatar Nov 18 '24 10:11 avasuro