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
DateInput2
behaves wrong with manual entering date value
#6665
Comments
@Lonli-Lokli that's quite an old version of Blueprint; can you repro the issue with the latest versions of those libraries? It's unlikely that a bug will get fixed in datetime2 v0.x |
@adidahiya Actually it's easy reproduced with new version too, because code is almost the same https://codesandbox.io/p/sandbox/blueprintjs-datetime2-forked-99zpqw?file=%2Fsrc%2FApp.tsx%3A55%2C13 Could you please also provide a workaround for v5? I hope I will port it in my v4 project too. |
@Lonli-Lokli thanks for updating the sandbox. I don't see how you are storing a "previous value" to be restored. As for reporting the value twice, I think you could easily work around that by checking if |
@adidahiya Let me first describe my real issue. Scenario 2 Scenario 3 Scenario 4 Both Scenario 3 and Scenario 4 could be handled with new event onSubmitted (it should happen with closing popup too). I still hope that if you go with this route you will backport this to v4 So now, answering your question, I do not save anywhere previous value as I dont need them but expecting to get always valid last-submitted from Control. Re: checking if dates are the same - again, with this approach when onChange is fired on any input it's kind of hard to predict when to revert |
There isn't really a concept of "submitting" in most Blueprint form components. They are very low-level components that have state, and any modification changes that state immediately. This is because they are not meant to be submitted as they are modified. There are some specialized components (like |
Please remember that components might be used outside of any form, so you can name this property as onApplied. I don't get why you are disagree with the fact that any user input has several states - initial, editing, saved, and each state might be valid and invalid. |
Environment
"@blueprintjs/core": "4.20.2",
"@blueprintjs/datetime": "4.4.37",
"@blueprintjs/datetime2": "0.9.37",
Code Sandbox
https://codesandbox.io/p/sandbox/blueprintjs-datetime2-hkhyvm?file=%2Fsrc%2FApp.tsx%3A23%2C102
Steps to reproduce
2023-12-01
Enter
2023-05-01
Cancel
Actual behavior
Step 3 - New value reported twice
Step 5 - New value stays in editor
Expected behavior
Step 3 - New value reported once
Step 5 - Previous Value restored in editor
The text was updated successfully, but these errors were encountered: