Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.3.7
-
None
-
None
Description
The function Wicket.DateTime.substituteDate in wicket-date.js fails to correctly format dates.
Example: create a datetextfield like this
DateTextField birthDate = DateTextField.forDateStyle("birthdateFromAndTo", "M-");
and add a DatePicker to it:
birthDate.add(new DatePicker());
The datetextfield will only validate when the input matches 'd-MMM-yyyy' (for my locale, at least) as can be verified by executing birthDate.getTextFormat(). This translates to '17-augustus-2009' for today's date.
However, when a date is selected in the datepicker, it puts '17-8-2009' in the DateTextField. The reason is, I believe, that subsituteDate() assumes that all fields in the pattern are numbers. Instead, it should execute a proper date formatting. The function either should call the Wicket side to format the input date, or it should do it in javascript. On http://www.timdown.co.uk/code/simpledateformat.js I found an Apache licensed piece of javascript code that should do the work (it misses l10n though).
Attachments
Attachments
Issue Links
- is duplicated by
-
WICKET-2375 Changing the date format of org.apache.wicket.extensions.yui.calendar.DateField does not work
- Closed
- is related to
-
WICKET-2648 DatePicker javascript uses 4 symbols for year although pattern contains just yy
- Resolved