DateTimeField: small bugs
-------------------------
Key: WICKET-1863
URL: https://issues.apache.org/jira/browse/WICKET-1863
Project: Wicket
Issue Type: Bug
Components: wicket-datetime
Affects Versions: 1.4-M3
Reporter: Marieke Vandamme
Hello,
I found 2 different bugs that makes my applications react in the wrong way :
- onBeforeRender:378
When the modelobject-date is null, the hours and minutes are not set to null
to. Now only date is set to null.
I use this object with ajax, and when the DateTimeField loads with a new
modelobject, the hours- and minutesfield holds the old value. If not clear, I
can make a quickstart.
- setDate:231
This function adjusts the modelobject with the filled in date. But the hours
and minutes aren't add.
I have overridden the function so it would work correctly. My code:
public void setDate(Date date)
{
super.setDate(date);
System.out.println("setDate [" + date + "]");
MutableDateTime modelDate = new MutableDateTime(date);
Integer hours = getHours();
Integer minutes = getMinutes();
boolean use12HourFormat = use12HourFormat();
if (hours != null) {
modelDate.set(DateTimeFieldType.hourOfDay(), hours.intValue() %
(use12HourFormat ? 12 : 24));
modelDate.setMinuteOfHour((minutes != null) ?
minutes.intValue() : 0);
}
setDefaultModelObject(modelDate.toDate());
}
Thanks a lot ! Marieke.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.