How to resolve unparseable Date issued from DatePickerConverter
Problem Description
Last on was encountered with the usage of Timesheet report and portlet ...
In the TimeSheet Portlet, a HREF is build in the Velocity Template as follow :
<a href="$req.contextPath/secure/ConfigureReport.jspa?startDate=$startDate&endDate=$endDate&reportKey=com.fdu.jira.plugin:timesheetreport">$i18n.getText("portlet.timesheet.details")</a>
The $startDate and $endDate variables were built in Portlet Class using the DatePickerConverter which assumes I18n conversion. Fine !
Instead of english language, we have in French, like some other country, some special characters. I.E. for February, a date formated dd/MMM/yyyy will give 01/Févr./2006 .
It appears that if the above mentionned dates are display as simple text, they are correct, but
if they are used in <a href=".." /> tag, they are two time converted (UTF-8 or UNICODE conversion ? I do not find how !).
How it may be resolved
The only solution I found was to convert the HTTP Query from GET to POST ...
... <script type="text/javascript"> function DisplayTimeSheetReport(startDate, endDate) { aForm = document.getElementById("TimeSheetReportForm"); aForm.action="$req.contextPath/secure/ConfigureReport.jspa"; aForm.startDate.value=startDate; aForm.endDate.value=endDate; aForm.submit(); } </script> <table border="0" cellpadding="3" cellspacing="1" width="100%"> <tr class=rowHeader> <td class="colHeaderLink" colspan="5"> <form id="TimeSheetReportForm" name="TimeSheetReportForm" action="" method="post"> <input type="hidden" name="reportKey" value="jira.plugin.kaamelot.timesheet:timesheetreport"> <input type="hidden" name="startDate" value=""> <input type="hidden" name="endDate" value=""> </form> $i18n.getText("portlet.timesheet.name") : (<a style="cursor :pointer; cursor :hand" onclick="DisplayTimeSheetReport('$dpc.getString($startDate)','$dpc.getString($endDate)')">$i18n.getText("portlet.timesheet.details")</a><font>) ...
