(bug 42097) $.tablesorter fix when wgDefaultDateFormat is unrecognized
authorMatmaRex <matma.rex@gmail.com>
Wed, 14 Nov 2012 20:25:43 +0000 (21:25 +0100)
committerBrad Jorsch <bjorsch@wikimedia.org>
Wed, 14 Nov 2012 20:56:01 +0000 (12:56 -0800)
The 'date' parser assumed all wikis use wgDefaultDateFormat that is
either 'mdy' or 'dmy', but this is not the case; for example
fi.wikipedia uses 'fi normal'. Therefore the correct value was not set,
a string was not changed to an array, and a loop that assumed an array
would be present hanged forever.

Change-Id: Iba17bc6b44d6a2fff491b7462d7a5457f85d19c5

resources/jquery/jquery.tablesorter.js

index 75dd2f1..95e9e3d 100644 (file)
                                        s = [ match[3], match[1], match[2] ];
                                } else if ( mw.config.get( 'wgDefaultDateFormat' ) === 'dmy' ) {
                                        s = [ match[3], match[2], match[1] ];
+                               } else {
+                                       // If we get here, we don't know which order the dd-dd-dddd
+                                       // date is in. So return something not entirely invalid.
+                                       return '99999999';
                                }
                        } else if ( ( match = s.match( ts.dateRegex[1] ) ) !== null ) {
                                s = [ match[3], '' + ts.monthNames[match[2]], match[1] ];