2015-03-28 20:03:50 +00:00
/*! Parser: Extract out date - updated 10/26/2014 (v2.18.0) */
2015-10-31 15:08:21 +00:00
/*jshint jquery:true */
2015-03-28 20:03:50 +00:00
! function ( a ) { "use strict" ; var b = { usLong : /[A-Z]{3,10}\.?\s+\d{1,2},?\s+(?:\d{4})(?:\s+\d{1,2}:\d{2}(?::\d{2})?(?:\s+[AP]M)?)?/i , mdy : /(\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/i , dmy : /(\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/i , dmyreplace : /(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/ , ymd : /(\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/i , ymdreplace : /(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/ } ; /*! extract US Long Date */
2015-10-31 15:08:21 +00:00
/ * ( i g n o r e a n y o t h e r t e x t )
* e . g . 'Sue' s Birthday ! Jun 26 , 2004 7 : 22 AM ( 8 # 2 oz ) '
* demo : http : //jsfiddle.net/Mottie/abkNM/4165/ */
a . tablesorter . addParser ( { id : "extractUSLongDate" , is : function ( ) {
// don't auto detect this parser
return ! 1 } , format : function ( a ) { var c , d = a ? a . match ( b . usLong ) : a ; return d ? ( c = new Date ( d [ 0 ] ) , c instanceof Date && isFinite ( c ) ? c . getTime ( ) : a ) : a } , type : "numeric" } ) , /*! extract MMDDYYYY */
/ * ( i g n o r e a n y o t h e r t e x t )
* demo : http : //jsfiddle.net/Mottie/abkNM/4166/ */
a . tablesorter . addParser ( { id : "extractMMDDYYYY" , is : function ( ) {
// don't auto detect this parser
return ! 1 } , format : function ( a ) { var c , d = a ? a . replace ( /\s+/g , " " ) . replace ( /[\-.,]/g , "/" ) . match ( b . mdy ) : a ; return d ? ( c = new Date ( d [ 0 ] ) , c instanceof Date && isFinite ( c ) ? c . getTime ( ) : a ) : a } , type : "numeric" } ) , /*! extract DDMMYYYY */
/ * ( i g n o r e a n y o t h e r t e x t )
* demo : http : //jsfiddle.net/Mottie/abkNM/4167/ */
a . tablesorter . addParser ( { id : "extractDDMMYYYY" , is : function ( ) {
// don't auto detect this parser
return ! 1 } , format : function ( a ) { var c , d = a ? a . replace ( /\s+/g , " " ) . replace ( /[\-.,]/g , "/" ) . match ( b . dmy ) : a ; return d ? ( c = new Date ( d [ 0 ] . replace ( b . dmyreplace , "$2/$1/$3" ) ) , c instanceof Date && isFinite ( c ) ? c . getTime ( ) : a ) : a } , type : "numeric" } ) , /*! extract YYYYMMDD */
/ * ( i g n o r e a n y o t h e r t e x t )
* demo : http : //jsfiddle.net/Mottie/abkNM/4168/ */
a . tablesorter . addParser ( { id : "extractYYYYMMDD" , is : function ( ) {
// don't auto detect this parser
return ! 1 } , format : function ( a ) { var c , d = a ? a . replace ( /\s+/g , " " ) . replace ( /[\-.,]/g , "/" ) . match ( b . ymd ) : a ; return d ? ( c = new Date ( d [ 0 ] . replace ( b . ymdreplace , "$2/$3/$1" ) ) , c instanceof Date && isFinite ( c ) ? c . getTime ( ) : a ) : a } , type : "numeric" } ) } ( jQuery ) ;