PHP Classes

File: source/asset/crules/datatables-plugins/sorting/datetime-moment.js

Recommend this page to a friend!
  Classes of ask sa sa   Rimau waf   source/asset/crules/datatables-plugins/sorting/datetime-moment.js   Download  
File: source/asset/crules/datatables-plugins/sorting/datetime-moment.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Rimau waf
Application to configure Web server module options
Author: By
Last change:
Date: 1 year ago
Size: 1,299 bytes
 

Contents

Class file image Download
/** * This plug-in for DataTables represents the ultimate option in extensibility * for sorting date / time strings correctly. It uses * [Moment.js](http://momentjs.com) to create automatic type detection and * sorting plug-ins for DataTables based on a given format. This way, DataTables * will automatically detect your temporal information and sort it correctly. * * For usage instructions, please see the DataTables blog * post that [introduces it](//datatables.net/blog/2014-12-18). * * @name Ultimate Date / Time sorting * @summary Sort date and time in any format using Moment.js * @author [Allan Jardine](//datatables.net) * @depends DataTables 1.10+, Moment.js 1.7+ * * @example * $.fn.dataTable.moment( 'HH:mm MMM D, YY' ); * $.fn.dataTable.moment( 'dddd, MMMM Do, YYYY' ); * * $('#example').DataTable(); */ (function($) { $.fn.dataTable.moment = function ( format, locale ) { var types = $.fn.dataTable.ext.type; // Add type detection types.detect.unshift( function ( d ) { return moment( d, format, locale, true ).isValid() ? 'moment-'+format : null; } ); // Add sorting method - use an integer for the sorting types.order[ 'moment-'+format+'-pre' ] = function ( d ) { return moment( d, format, locale, true ).unix(); }; }; }(jQuery));