I was looking for this question and no existing answer seems to apply. Consider the following:
[ { 'August 17th 2016': [75] }, // 75 is the length of the array which contains up to 75 objects ... { 'August 1st 2016': [5] }, { 'August 28th 2016': [5] }, ... ]
What is the best way to sort the objects in this array by date and save the "English" representation of their key?
Note : The key is used as a chart label.
Everywhere I look at array.sort
, but on the key of the created_at
object.
The result should be:
[ { 'August 1st 2016': [5] }, { 'August 17th 2016': [75] } { 'August 28th 2016': [5] }, ... ]
Iโm not sure how to act, so I have nothing to show.
source share