Created
May 7, 2012 08:54
-
-
Save anroots/2626766 to your computer and use it in GitHub Desktop.
Custom Tablesorter parser for Estonian date formats (dd.mm.YYYY)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Custom date format parser for Estonian for the Tablesorter(.com) jQuery plugin | |
$.tablesorter.addParser({ | |
id:'estDate', | |
is:function (s) { | |
return /\d{1,2}[\/\-\.]\d{1,2}[\/\-\.]\d{2,4}/.test(s); | |
}, | |
format:function (s, table) { | |
var c = table.config; | |
s = s.replace(/\-/g, '/'); | |
s = s.replace(/(\d{1,2})\.(\d{1,2})\.(\d{4})/, '$3/$2/$1'); | |
return $.tablesorter.formatFloat(new Date(s).getTime()); | |
}, | |
type:'numeric' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment