diff options
author | Slávek Banko <[email protected]> | 2014-03-03 13:46:44 +0100 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2014-03-03 13:46:44 +0100 |
commit | 2e02da046d3e56cdf4744f644af35ad07424f48b (patch) | |
tree | f2dcf353aa2338eae1c2ff2c41af971c580c2762 /xslt/tellico2html.js | |
parent | 3c13229d98167ae4ae0710d5eeef23fef5005bf0 (diff) | |
download | tellico-2e02da046d3e56cdf4744f644af35ad07424f48b.tar.gz tellico-2e02da046d3e56cdf4744f644af35ad07424f48b.zip |
Update to upstream version 1.3.6
Diffstat (limited to 'xslt/tellico2html.js')
-rw-r--r-- | xslt/tellico2html.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/xslt/tellico2html.js b/xslt/tellico2html.js index 8a3f5df..fa08d58 100644 --- a/xslt/tellico2html.js +++ b/xslt/tellico2html.js @@ -127,8 +127,8 @@ sorttable = { if (!document.createElement || !document.getElementsByTagName) return; - sorttable.DATE_RE = /^(\d\d)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; - sorttable.YYMMDD_RE = /^((\d\d)?\d\d)[\/\.-](\d\d?)[\/\.-](\d\d)$/; + sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-](\d{4}|\d\d)$/; + sorttable.YYMMDD_RE = /^(\d{4}|\d\d)[\/\.-](\d\d?)[\/\.-](\d\d?)$/; forEach(document.getElementsByTagName('table'), function(table) { if (table.className.search(/\bsortable\b/) != -1) { @@ -371,7 +371,8 @@ sorttable = { if (mtch) { y = mtch[1]; m = mtch[2]; d = mtch[3]; // y2k notes: two digit years less than 50 are treated as 20XX, greater than 50 are treated as 19XX - if (parseInt(y) < 50) y = '20'+y; else y = '19'+y; + if (y.length == 2) + if (parseInt(y) < 50) y = '20'+y; else y = '19'+y; if (m.length == 1) m = '0'+m; if (d.length == 1) d = '0'+d; dt1 = y+m+d; @@ -379,7 +380,8 @@ sorttable = { mtch = b[0].match(sorttable.YYMMDD_RE); if (mtch) { y = mtch[1]; m = mtch[2]; d = mtch[3]; - if (parseInt(y) < 50) y = '20'+y; else y = '19'+y; + if (y.length == 2) + if (parseInt(y) < 50) y = '20'+y; else y = '19'+y; if (m.length == 1) m = '0'+m; if (d.length == 1) d = '0'+d; dt2 = y+m+d; |