-
Notifications
You must be signed in to change notification settings - Fork 6
Date Formats
Changing the date format used by CrissCross is a bit fiddly at the moment; this will be improved in future.
By default CrissCross uses UK style dates - "30/12/2012" or "30/Dec/2012". To change to something else, do the following:
In CrissCross/Scripts/CrissCrossClient.js, find the following functuion defn:
this.renderParameterDatePick = function(paramInfo, renderBeforeId) {
Near the top of this function is code to instantiate the jQuery UI DatePicker widget. This sets the dateFormat option:
$("#" + paramInfo.id + "_control").datepicker({
showOn: "both",
buttonImage: "Content/images/calendar.gif",
buttonImageOnly: true,
dateFormat: 'dd/mm/yy',
showOtherMonths: true,
selectOtherMonths: true
});
For USA-style dates, change this to 'mm/dd/yy'. For other formats, see http://docs.jquery.com/UI/Datepicker/formatDate
When CrissCrossClient.js has been changed, browsers may cache the previous version so try a CTRL-F5 refresh when looking at Report.aspx to make sure the changes are downloaded.
On the server-side, there is a class that converts the users parameter selection into text so that it can be displayed on the page.
In the file CrissCrossLib/CrcParameterConverter.cs, find this function:
public List<string> GetReportParametersForUser(CrcReportDefinition reptDefn, int truncateListLimit)
Within that function, the following line converts users date selections to text:
if (paramDefn.ParameterType == CrcParameterType.Date)
{
valueString = DateTime.Parse(paramDefn.ParameterChoice.SingleValue).ToString("dd/MMM/yyyy");
}
For USA-style dates, change the ToString() format to "MM/dd/yyyy". For other formats see http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx