Date (`dd/mm/yyyy`)

Detect data which is in the date format dd/mm/yyyy

  • Author: Andy McMaster

Automatically detect British (dd/mm/yyyy) date types. Goes with the UK date sorting plug-in.

Plug-in code

jQuery.fn.dataTableExt.aTypes.unshift(
    function ( sData )
    {
        if (sData !== null && sData.match(/^(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[012])\/(19|20|21)\d\d$/))
        {
            return 'date-uk';
        }
        return null;
    }
);

CDN

This plug-in is available on the DataTables CDN:

JS

Note that if you are using multiple plug-ins, it is beneficial in terms of performance to combine the plug-ins into a single file and host it on your own server, rather than making multiple requests to the DataTables CDN.

Version control

If you have any ideas for how this plug-in can be improved, or spot anything that is in error, it is available on GitHub and pull requests are very welcome!