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

Closed
Toilal opened this Issue Dec 18, 2014 · 3 comments

Comments

Projects
None yet
3 participants
@Toilal
Copy link
Contributor

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 : http://plnkr.co/edit/tzcbq7gJgOXvY5gj5QI0?p=preview

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.
@cherbst

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.

@Toilal

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.

@pkozlowski-opensource

This comment has been minimized.

Copy link
Member

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.