Here is the code:
var collection = [new Date(2014, 11, 25), new Date(2014, 11, 24)]; var d=new Date(2014, 11, 24); var idx= collection.indexOf(d);
This is because your "d" object is the different object. In other words:
var d = new Date(2014, 11, 24); d === new Date(2014, 11, 24); // returns false
You can try this:
var d = new Date(2014, 11, 24); var collection = [new Date(2014, 11, 25), d]; var idx = collection.indexOf(d); // returns 1