I want to sort an array by date. But ignore the first item in the array. Any help would be much appreciated.
I have this currently:
articles.sort(function(a,b){
return new Date(b.published) - new Date(a.published);
});
my array looks like this:
[
{id: 1, published: Mar 12 2012 08:00:00 AM},
{id: 2, published: Mar 9 2012 08:00:00 AM},
{id: 3, published: Mar 15 2012 08:00:00 AM},
{id: 4, published: Mar 22 2012 08:00:00 AM},
{id: 5, published: Mar 8 2012 08:00:00 AM}
];
I just need to sort everything by date from id 2 - 5
What I have sorts everything.
Thanks
publishedproperty that doesn't exist in the array you provided. Please update your post as necessary.