Ok, I managed to find the problem using the javascript debug function of Firebug, but I have no idea on how to solve it.
The problematic code lies in the file wicket-date.js: 125 /** 126 * Return the result of interpolating the value (date) argument with the date pattern. 127 * The dateValue has to be an array, where year is in the first, month in the second 128 * and date (day of month) in the third slot. 129 */ 130 Wicket.DateTime.substituteDate = function(datePattern, date) { 131 day = date[2]; 132 month = date[1]; 133 year = date[0]; 134 // optionally do some padding to match the pattern 135 if(datePattern.match(/dd+/)) day = Wicket.DateTime.padDateFragment(day); 136 if(datePattern.match(/MM+/)) month = Wicket.DateTime.padDateFragment(month); 137 if(datePattern.match(/yy+/)) year = Wicket.DateTime.padDateFragment(year % 100); 138 // replace pattern with real values 139 return datePattern.replace(/d+/, day).replace(/M+/, month).replace(/y+/, year); 140 } On the line 137 it truncates the year from 2010 to 10, and simply ignores the fact that I want a 4 digit year. When I did the same debugging on the example on wicketstuff.org I found that this javascript function looked a little bit different: 80 Wicket.DateTime.substituteDate = function(datePattern, date) { 71 day = date[2]; 72 month = date[1]; 73 year = date[0]; 74 if(datePattern.match(/dd+/)) day = Wicket.DateTime.padDateFragment(day); 75 if(datePattern.match(/MM+/)) month = Wicket.DateTime.padDateFragment(month); 76 if(datePattern.match(/byy+/)) year = Wicket.DateTime.padDateFragment(year % 100); 77 return datePattern.replace(/d+/, day).replace(/M+/, month).replace(/y+/, year); 78 } Here on line 76 it sees if the datePattern matches "byy+", I have no idea what that 'b' i supposed to mean, but the result is that it doesn't truncate the year from 4 to 2 digits. I also noted that these two *different* wicket-date.js files contain the exact same versioning information: YAHOO.register("wicket-date", Wicket.DateTime, {version: "1.3.0", build: "rc1"}); So, does anyone know what I can do to get the correct wicket-date.js? Or should I report this as a bug somewhere? The way I see it, the javascript should check if the datepattern matches "yyyy" and then leave the year as it is. /Jimi -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Javascript-string-formatting-problem-with-DateTextField-and-DatePicker-tp2241433p2241559.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org