Function "sortMMDDStr" throws an error stating "dateRE" is undefined.
saurabhmahajan opened this issue · comments
Function "sortMMDDStr" throws an error stating "dateRE" is undefined. Below is the code snippet and you can see the code
mtch = b.match(dateRE);
uses "dateRE" as it is, instead what it should be doing is calling it using
mtch = b.match(window.kg.sortService.dateRE);
I will submit a pull request and fix for the same.
-------- Code------
sortMMDDStr: function (a, b) {
var dateA, dateB, mtch, m, d, y;
mtch = a.match(window.kg.sortService.dateRE);
y = mtch[3];
d = mtch[2];
m = mtch[1];
if (m.length == 1) {
m = '0' + m;
}
if (d.length == 1) {
d = '0' + d;
}
dateA = y + m + d;
mtch = b.match(dateRE);
y = mtch[3];
d = mtch[2];
m = mtch[1];
if (m.length == 1) {
m = '0' + m;
}
if (d.length == 1) {
d = '0' + d;
}
dateB = y + m + d;
if (dateA == dateB) {
return 0;
}
if (dateA < dateB) {
return -1;
}
return 1;
},
I already fixed this on our local version. Change the following line:
mtch = b.match(dateRE);
It should read:
mtch = b.match(window.kg.sortService.dateRE);