Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
PopupDateField - get assigned date time ?
I have a question regarding the popupdatefield component.
I have added one to my subwindow and I have assigned it a value and it works just fine. However I am a little confused when it comes to querying the value (date) that is has assigned by the user.
If I read back the date using .getvalue() when I have not interacted with the calendar at all it comes back in the format
if I change the date visually on screen and then query the value it comes back in the format
I need to be able to parse the string back into a datetime and the variable format is giving me a headache
Date date = new SimpleDateFormat(popupDateField_DueDate.getDateFormat(), popupDateField_DueDate.getLocale()).parse(popupDateField_DueDate.getValue().toString());
but this just gives a parsing error
Strange you can assign a datetime to the control but not get one back
It seems as though .getDateFormat in both cases is coming back as yyyy-MM-dd HH:mm:ss even when the value.toString() is returning Mon Apr 09 22:09:13 BST 2012
Is this a bug ?
The PopupDateField returns a java.util.Date as its value. Try using that instead of casting it to a string.
Ah indeed - that did the trick.