diff options
| author | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-03-13 02:35:32 +0200 |
|---|---|---|
| committer | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-03-13 02:35:32 +0200 |
| commit | 4eac9731fe77023488cdf3aa124a6aa1e5444a59 (patch) | |
| tree | 7c9510b23ea7a40a2280b39e87e55a1612309df1 /html/assets/js/dataTables/datatables.date-uk.js | |
| parent | 33266244e8c75c29f31dd5dce756e55fb10a0b9b (diff) | |
| download | classroom-4eac9731fe77023488cdf3aa124a6aa1e5444a59.tar.gz classroom-4eac9731fe77023488cdf3aa124a6aa1e5444a59.tar.bz2 classroom-4eac9731fe77023488cdf3aa124a6aa1e5444a59.zip | |
setup needed libraries for browser-scripting
Diffstat (limited to 'html/assets/js/dataTables/datatables.date-uk.js')
| -rw-r--r-- | html/assets/js/dataTables/datatables.date-uk.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/html/assets/js/dataTables/datatables.date-uk.js b/html/assets/js/dataTables/datatables.date-uk.js new file mode 100644 index 0000000..527ea6c --- /dev/null +++ b/html/assets/js/dataTables/datatables.date-uk.js @@ -0,0 +1,42 @@ +/** + * DataTables internal date sorting replies on `Date.parse()` which is part of + * the Javascript language, but you may wish to sort on dates which is doesn't + * recognise. The following is a plug-in for sorting dates in the format + * `dd/mm/yy`. + * + * An automatic type detection plug-in is available for this sorting plug-in. + * + * Please note that this plug-in is **deprecated*. The + * [datetime](//datatables.net/blog/2014-12-18) plug-in provides enhanced + * functionality and flexibility. + * + * @name Date (dd/mm/YY) + * @summary Sort dates in the format `dd/mm/YY` + * @author Andy McMaster + * @deprecated + * + * @example + * $('#example').dataTable( { + * columnDefs: [ + * { type: 'date-uk', targets: 0 } + * ] + * } ); + */ + + jQuery.extend( jQuery.fn.dataTableExt.oSort, { + "date-uk-pre": function ( a ) { + if (a == null || a == "") { + return 0; + } + var ukDatea = a.split('/'); + return (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1; + }, + + "date-uk-asc": function ( a, b ) { + return ((a < b) ? -1 : ((a > b) ? 1 : 0)); + }, + + "date-uk-desc": function ( a, b ) { + return ((a < b) ? 1 : ((a > b) ? -1 : 0)); + } +} ); |
