TheDJ has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/375514 )

Change subject: TableSorter: Sort unrecognized dates as -Infinity
......................................................................

TableSorter: Sort unrecognized dates as -Infinity

Follow-up to: I664b4cc
Bug: T174814

Change-Id: I028681172be7a30e51cab42847c4fc35e9358aca
---
M resources/src/jquery/jquery.tablesorter.js
M tests/qunit/suites/resources/jquery/jquery.tablesorter.parsers.test.js
2 files changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/14/375514/1

diff --git a/resources/src/jquery/jquery.tablesorter.js 
b/resources/src/jquery/jquery.tablesorter.js
index 922da31..ecd376a 100644
--- a/resources/src/jquery/jquery.tablesorter.js
+++ b/resources/src/jquery/jquery.tablesorter.js
@@ -1163,7 +1163,7 @@
                                match = s.match( ts.rgx.isoDate[ 1 ] );
                        }
                        if ( !match ) {
-                               return 0;
+                               return -Infinity;
                        }
                        // Month and day
                        for ( i = 2; i <= 4; i += 2 ) {
diff --git 
a/tests/qunit/suites/resources/jquery/jquery.tablesorter.parsers.test.js 
b/tests/qunit/suites/resources/jquery/jquery.tablesorter.parsers.test.js
index 257699a..01589c3 100644
--- a/tests/qunit/suites/resources/jquery/jquery.tablesorter.parsers.test.js
+++ b/tests/qunit/suites/resources/jquery/jquery.tablesorter.parsers.test.js
@@ -174,7 +174,8 @@
        parserTest( 'Y Dates', 'date', YDates );
 
        ISODates = [
-               [ '2000',               false,  946684800000, 'Plain 4-digit 
year' ],
+               [ '',           false,  -Infinity, 'Not a date' ],
+               [ '2000',       false,  946684800000, 'Plain 4-digit year' ],
                [ '2000-01',    true,   946684800000, 'Year with month' ],
                [ '2000-01-01', true,   946684800000, 'Year with month and day' 
],
                [ '2000-13-01', false,  978307200000, 'Non existant month' ],

-- 
To view, visit https://gerrit.wikimedia.org/r/375514
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I028681172be7a30e51cab42847c4fc35e9358aca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: TheDJ <hartman.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to