primefaces / primefaces/primereact

Calendar: Cannot paste new value when mask is present (keeps old value)

Open
#8,245 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Status: Needs Triage
Dominant language
CSS
Stars
8.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

When I have a mask on my Calendar component and I try to paste a valid date from my clipboard, I see that the new value that I'm trying to set doesn't show on any function like parseDateTime.

It looks like the library is deleting this value even before it makes it available to the api of any function (onChange, parseDateTime...).

Reproducer

https://stackblitz-starters-frufzshp.stackblitz.io

System Information
"primereact": "^10.9.2",
"react": "18.2.0",
Steps to reproduce the behavior
  1. Copy a valid date with this format 01/01/2005
  2. Paste it in the Calendar input box
  3. Watch it keeping the old value and not coming in the function parseDateTime
Expected behavior

I would expect the new value to be set in the Calendar input box

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Calendar component and reproduce the issue using the linked StackBlitz example: paste 01/01/2005 into a masked Calendar input and observe the existing value. Trace the paste and parsing flow to determine why the pasted date is discarded; done means the new date appears in the input and reaches parseDateTime or onChange.

Written by the indexing model from the issue text.

Assessment

Tech stack
react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.