I see that this question was asked quite often for regular javascript arrays, however, none of the answers work if its an array of dates.
I can probably figure this out through a trial error, but I see some advantages for others, if I ask.
Basically, if you have an array of javascript dates that can have duplicates, and you need to filter them into an array without duplicates, which is best for this?
I tried the ES6 solution Array.from Array.from(new Set(arr)) , but it just returns the same array.
Also i tried
Array.prototype.unique = function() { var a = []; for (var i=0, l=this.length; i<l; i++) if (a.indexOf(this[i]) === -1) a.push(this[i]); return a; }
both came from unique values ββin the array
However, none of them work, it looks like indexOf does not work with date objects.
This is how my array is created by atm
It's about 100 or so different days, but always ends with about 350 indexes.
source share