13 lines
440 B
JavaScript
13 lines
440 B
JavaScript
"use strict";
|
|
|
|
$.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-".concat(format) : null;
|
|
}); // Add sorting method - use an integer for the sorting
|
|
|
|
types.order["moment-".concat(format, "-pre")] = function (d) {
|
|
return moment(d, format, locale, true).unix();
|
|
};
|
|
}; |