mihaifm / linq

linq.js - LINQ for JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OrderBy incorrect on IE11

screaney opened this issue · comments

I found that doing OrderBy() then ThenBy() on IE 11 returns a different result set than on Chrome or Firefox.

Created jsfiddle to reproduce:
https://jsfiddle.net/screaney/gj0gwxfo/4/

It appears on IE the ThenBy places them in reverse instead of asc/asc.

I checked your fiddle, indeed it replicates on IE, however I don't think it's a problem with the library. In your code you are comparing moment.utc objects, I think the difference comes from the way IE handles object comparison internally.
To fix this you should be comparing strings. Looking over the documentation for moment.js, I see that you can call moment.utc(...).format() to get a string representation.

It works for me:
https://jsfiddle.net/Ljef8eks/