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:

DatePicker Control

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.

CrcParameterConverer

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

Last edited Jan 25, 2013 at 8:59 AM by codeulike, version 4

Comments

DerekR Dec 3, 2013 at 3:25 PM 
I'm afraid the above comments don't match my reality.
I have a totally en-GB environment all set up as above but I was still getting US style date formats.
I changed the "crisscross.CultureForDateParsing" value in web.config to "flexi-gb-us" (gleened from the source code) and it seems to work. I think the function ParseDateStringVariousWays needs a little attention.
Now I'm just not getting my default date values passed through but it's progress.