From d013737d26528064a222d673b221d9870d1dc9f3 Mon Sep 17 00:00:00 2001 From: Grex Date: Mon, 8 Aug 2016 09:43:10 +0200 Subject: [PATCH] fix to sort with seconds Sorting with format dd.mm.YYYY HH:mm:ss has been added --- sorting/date-de.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/sorting/date-de.js b/sorting/date-de.js index 0a5a096..c3bffb7 100644 --- a/sorting/date-de.js +++ b/sorting/date-de.js @@ -29,7 +29,11 @@ var deDatea = jQuery.trim(a).split(' '); var deTimea = deDatea[1].split(':'); var deDatea2 = deDatea[0].split('.'); - x = (deDatea2[2] + deDatea2[1] + deDatea2[0] + deTimea[0] + deTimea[1]) * 1; + if(typeof deTimea[2] != 'undefined') { + x = (deDatea2[2] + deDatea2[1] + deDatea2[0] + deTimea[0] + deTimea[1] + deTimea[2]) * 1; + } else { + x = (deDatea2[2] + deDatea2[1] + deDatea2[0] + deTimea[0] + deTimea[1]) * 1; + } } else { x = Infinity; // = l'an 1000 ... } @@ -38,7 +42,11 @@ var deDateb = jQuery.trim(b).split(' '); var deTimeb = deDateb[1].split(':'); deDateb = deDateb[0].split('.'); - y = (deDateb[2] + deDateb[1] + deDateb[0] + deTimeb[0] + deTimeb[1]) * 1; + if(typeof deTimeb[2] != 'undefined') { + y = (deDateb[2] + deDateb[1] + deDateb[0] + deTimeb[0] + deTimeb[1] + deTimeb[2]) * 1; + } else { + y = (deDateb[2] + deDateb[1] + deDateb[0] + deTimeb[0] + deTimeb[1]) * 1; + } } else { y = Infinity; } @@ -52,7 +60,11 @@ var deDatea = jQuery.trim(a).split(' '); var deTimea = deDatea[1].split(':'); var deDatea2 = deDatea[0].split('.'); - x = (deDatea2[2] + deDatea2[1] + deDatea2[0] + deTimea[0] + deTimea[1]) * 1; + if(typeof deTimea[2] != 'undefined') { + x = (deDatea2[2] + deDatea2[1] + deDatea2[0] + deTimea[0] + deTimea[1] + deTimea[2]) * 1; + } else { + x = (deDatea2[2] + deDatea2[1] + deDatea2[0] + deTimea[0] + deTimea[1]) * 1; + } } else { x = Infinity; } @@ -61,7 +73,11 @@ var deDateb = jQuery.trim(b).split(' '); var deTimeb = deDateb[1].split(':'); deDateb = deDateb[0].split('.'); - y = (deDateb[2] + deDateb[1] + deDateb[0] + deTimeb[0] + deTimeb[1]) * 1; + if(typeof deTimeb[2] != 'undefined') { + y = (deDateb[2] + deDateb[1] + deDateb[0] + deTimeb[0] + deTimeb[1] + deTimeb[2]) * 1; + } else { + y = (deDateb[2] + deDateb[1] + deDateb[0] + deTimeb[0] + deTimeb[1]) * 1; + } } else { y = Infinity; } @@ -107,4 +123,3 @@ return z; } } ); -