Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function "sortMMDDStr" throws an error stating "dateRE" is undefined. #272

Closed
saurabhmahajan opened this issue Nov 19, 2013 · 2 comments
Closed

Comments

@saurabhmahajan
Copy link

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;
},

@sigilaea
Copy link

sigilaea commented Dec 4, 2013

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);

@crissdev
Copy link
Member

The fix is available in 2.1.5 branch. 869208f


Going to mark this issue as duplicate although it was reported before #295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants