Just submitted a bug report related to this issue. The DatePicker could now commit back to the old / previous value when the user selection of a new date via the dropdown also triggers the closing of the dialog that is showing the date picker. In that case the newly added commitValue() method will use the date expressed by the text inside the editor (TextField), which is actually the old date.
Dirk > On 7 Dec 2021, at 14:11, Kevin Rushforth <k...@openjdk.java.net> wrote: > > On Wed, 24 Nov 2021 09:09:53 GMT, Marius Hanl <mh...@openjdk.org> wrote: > >> This PR fixes an issue where the `DatePicker` is not committing his text as >> value when the focus is lost. >> As the ticket also mentions, this is a regression which last worked on >> JavaFX 8 and got broken by this refactoring: >> [JDK-8150946](https://bugs.openjdk.java.net/browse/JDK-8150946) >> >> The fix is to provide the same api to the `DatePicker` which was introduced >> by [JDK-8150946](https://bugs.openjdk.java.net/browse/JDK-8150946) for >> `ComboBox` and `Spinner`. >> >> Note: While fixing this I found a possible bug which I tracked here: >> [JDK-8277756](https://bugs.openjdk.java.net/browse/JDK-8277756) >> -> When creating a `DatePicker` with the second constructor (with >> `LocalDate` as parameter) two listener won't be added since they are only >> added at the first constructor (That's also why I added the focusProperty >> listener in the second constructor). > > Looks good. I've also "Reviewed" the CSR, so it can be finalized. > > ------------- > > Marked as reviewed by kcr (Lead). > > PR: https://git.openjdk.java.net/jfx/pull/679