Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
31178 tejbeer 1
/**
2
 * This plug-in will provide date sorting for the "dd/mm/YYYY hh:ii:ss" 
3
 * formatting, which is common in France and other European countries. It can 
4
 * also be quickly adapted for other formatting as required. Furthermore, this 
5
 * date sorting plug-in allows for empty values in the column.
6
 *
7
 * Please note that this plug-in is **deprecated*. The
8
 * [datetime](//datatables.net/blog/2014-12-18) plug-in provides enhanced
9
 * functionality and flexibility.
10
 *
11
 *  @name Date (dd/mm/YYYY hh:ii:ss) 
12
 *  @summary Sort date / time in the format `dd/mm/YYYY hh:ii:ss`
13
 *  @author [Ronan Guilloux](http://coolforest.net/)
14
 *  @deprecated
15
 *
16
 *  @example
17
 *    $('#example').dataTable( {
18
 *       columnDefs: [
19
 *         { type: 'date-euro', targets: 0 }
20
 *       ]
21
 *    } );
22
 */
23
 
24
jQuery.extend(jQuery.fn.dataTableExt.oSort, {
25
	"date-euro-pre": function(a) {
26
		var x;
27
 
28
		if ($.trim(a) !== '') {
29
			var frDatea = $.trim(a).split(' ');
30
			var frTimea = (undefined != frDatea[1]) ? frDatea[1].split(':') : [00, 00, 00];
31
			var frDatea2 = frDatea[0].split('/');
32
			x = (frDatea2[2] + frDatea2[1] + frDatea2[0] + frTimea[0] + frTimea[1] + ((undefined != frTimea[2]) ? frTimea[2] : 0)) * 1;
33
		}
34
		else {
35
			x = Infinity;
36
		}
37
 
38
		return x;
39
	},
40
 
41
	"date-euro-asc": function(a, b) {
42
		return a - b;
43
	},
44
 
45
	"date-euro-desc": function(a, b) {
46
		return b - a;
47
	}
48
});