TableSorter: Sort unrecognized dates as -Infinity
authorDerk-Jan Hartman <hartman.wiki@gmail.com>
Sat, 2 Sep 2017 08:51:48 +0000 (10:51 +0200)
committerTheDJ <hartman.wiki@gmail.com>
Sat, 2 Sep 2017 09:32:31 +0000 (09:32 +0000)
Follow-up to: I664b4cc
Bug: T174814
Change-Id: I028681172be7a30e51cab42847c4fc35e9358aca

resources/src/jquery/jquery.tablesorter.js
tests/qunit/suites/resources/jquery/jquery.tablesorter.parsers.test.js

index 922da31..ecd376a 100644 (file)
                                match = s.match( ts.rgx.isoDate[ 1 ] );
                        }
                        if ( !match ) {
-                               return 0;
+                               return -Infinity;
                        }
                        // Month and day
                        for ( i = 2; i <= 4; i += 2 ) {
index 257699a..01589c3 100644 (file)
        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' ],