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

OrderBy filter doesn't work with dates (momentJS and native dates) #10512

Toilal opened this Issue Dec 18, 2014 · 3 comments


None yet
3 participants
Copy link

Toilal commented Dec 18, 2014

Since 1.3.7, OrderBy filter isn't working anymore with momentJS or native dates.

I've build a plunker to reproduce the issue :

Using angular 1.3.6 fix the issue.

Toilal added a commit to angular-gantt/angular-gantt that referenced this issue Dec 18, 2014

chore(bower): Use angularJS <= 1.3.6
Because of an issue in angularJS >= 1.3.7 (angular/angular.js#10512), we must avoid this version.

This comment has been minimized.

Copy link

cherbst commented Dec 18, 2014

I have tracked down this issue to the following commit: a097aa9.
This happens because the order in which the compared values are tried to be converted to primitives has been changed by this commit. Previously valueOf() has been tried before toString(). With this commit it is the other way around. This leads to dates being compared as strings which is obviously wrong.


This comment has been minimized.

Copy link
Contributor Author

Toilal commented Dec 18, 2014

Thanks @cherbst.

It's probably this valueOf() call that was making things works before. Calling valueOf() on native date or MomentJS date returns a timestamp which is comparable.


This comment has been minimized.

Copy link

pkozlowski-opensource commented Dec 18, 2014

Yeh, it sounds like a regression that we allowed to slip as our tests were not catching this exact situation... Sent a PR with a fix (#10516).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.