0

I am working on a personal project with react and I need to show the data with chart.js.

This is the data:

enter image description here

I need to sort this data by date to show in line chart.

I tried to sort with this code but it's not working:

enter image description here

If you have any idea how to solve this please share your answer.

Any response will be appreciated.

Tim567
  • 679
  • 4
  • 18
eminvergil
  • 45
  • 1
  • 5
  • 3
    https://stackoverflow.com/questions/10123953/how-to-sort-an-array-by-a-date-property – Nikita Madeev May 29 '20 at 11:02
  • 3
    You need to find a way to parse these dates into `Date` objects, then you can sort them by their `.getTime()` – Chris G May 29 '20 at 11:04
  • 1
    Please visit the [help], take the [tour] to see what and [ask]. Do some research, search for related topics on SO; if you get stuck, post a [mcve] of your attempt, noting input and expected output using the `[<>]` snippet editor. Post CODE, not PICTURES of code – mplungjan May 29 '20 at 11:05
  • 1
    Either create a daet object OR swap the parts in yyyymmdd to sort alphabetically – mplungjan May 29 '20 at 11:06

0 Answers0