I have an array of objects that have a 'date' string property.
ie:
[
{
id: 1,
startDate: '2011-4-22'
},
{
id: 2,
startDate: '2012-3-15'
},
{
id: 3,
startDate: '2011-4-22'
},
{
id: 4,
startDate: '2012-2-10'
}
]
I just want to convert the date strings to a date and sort them by startDate DESC. Can someone please tell me how to do this with teh underscore.js _sortBy method or even just plain javascript will do.
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…