2017-05-24 23:53:44 +00:00
|
|
|
/*! Parser: dates - updated 5/24/2017 (v2.28.11) */
|
2015-03-28 20:03:50 +00:00
|
|
|
/* Extract dates using popular natural language date parsers */
|
2013-03-26 21:05:21 +00:00
|
|
|
/*jshint jquery:true */
|
2016-08-21 14:50:50 +00:00
|
|
|
/*global Sugar*/
|
2018-03-17 20:30:25 +00:00
|
|
|
;(function($) {
|
2015-07-23 04:29:51 +00:00
|
|
|
'use strict';
|
2013-03-26 21:05:21 +00:00
|
|
|
|
2016-08-18 19:37:15 +00:00
|
|
|
/*! Sugar (https://sugarjs.com/docs/#/DateParsing) */
|
2017-05-22 11:30:43 +00:00
|
|
|
/* demo: http://jsfiddle.net/Mottie/7z0ss5xn/ */
|
2013-03-26 21:05:21 +00:00
|
|
|
$.tablesorter.addParser({
|
2015-05-02 20:15:56 +00:00
|
|
|
id: 'sugar',
|
2013-03-26 21:05:21 +00:00
|
|
|
is: function() {
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
format: function(s) {
|
2016-08-18 19:37:15 +00:00
|
|
|
// Add support for sugar v2.0+
|
|
|
|
var create = Date.create || Sugar.Date.create,
|
|
|
|
date = create ? create(s) : s ? new Date(s) : s;
|
2014-09-30 21:20:04 +00:00
|
|
|
return date instanceof Date && isFinite(date) ? date.getTime() : s;
|
2013-03-26 21:05:21 +00:00
|
|
|
},
|
2015-05-02 20:15:56 +00:00
|
|
|
type: 'numeric'
|
2013-03-26 21:05:21 +00:00
|
|
|
});
|
|
|
|
|
2015-03-28 20:03:50 +00:00
|
|
|
/*! Datejs (http://www.datejs.com/) */
|
2017-05-22 11:30:43 +00:00
|
|
|
/* demo: http://jsfiddle.net/Mottie/zge0L2u6/ */
|
2013-03-26 21:05:21 +00:00
|
|
|
$.tablesorter.addParser({
|
2015-05-02 20:15:56 +00:00
|
|
|
id: 'datejs',
|
2013-03-26 21:05:21 +00:00
|
|
|
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
|
|
|
},
|
2015-05-02 20:15:56 +00:00
|
|
|
type: 'numeric'
|
2013-03-26 21:05:21 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
})(jQuery);
|