2013-03-26 21:05:21 +00:00
|
|
|
/*!
|
|
|
|
* Extract dates using popular natural language date parsers
|
|
|
|
*/
|
|
|
|
/*jshint jquery:true */
|
|
|
|
;(function($){
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
/*! Sugar (http://sugarjs.com/dates#comparing_dates)
|
2014-09-30 21:20:04 +00:00
|
|
|
* demo: http://jsfiddle.net/Mottie/abkNM/4163/
|
2013-03-26 21:05:21 +00:00
|
|
|
*/
|
|
|
|
$.tablesorter.addParser({
|
|
|
|
id: "sugar",
|
|
|
|
is: function() {
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
format: function(s) {
|
2014-09-30 21:20:04 +00:00
|
|
|
var date = Date.create ? Date.create(s) : s ? new Date(s) : s;
|
|
|
|
return date instanceof Date && isFinite(date) ? date.getTime() : s;
|
2013-03-26 21:05:21 +00:00
|
|
|
},
|
|
|
|
type: "numeric"
|
|
|
|
});
|
|
|
|
|
|
|
|
/*! Datejs (http://www.datejs.com/)
|
2014-09-30 21:20:04 +00:00
|
|
|
* demo: http://jsfiddle.net/Mottie/abkNM/4164/
|
2013-03-26 21:05:21 +00:00
|
|
|
*/
|
|
|
|
$.tablesorter.addParser({
|
|
|
|
id: "datejs",
|
|
|
|
is: function() {
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
format: function(s) {
|
2014-09-30 21:20:04 +00:00
|
|
|
var date = Date.parse ? Date.parse(s) : s ? new Date(s) : s;
|
|
|
|
return date instanceof Date && isFinite(date) ? date.getTime() : s;
|
2013-03-26 21:05:21 +00:00
|
|
|
},
|
|
|
|
type: "numeric"
|
|
|
|
});
|
|
|
|
|
|
|
|
})(jQuery);
|