Sorting by Value in Array of Objects (List Item Value) - Sort by date


PHOTO EMBED

Sat Dec 26 2020 00:15:03 GMT+0000 (UTC)

Saved by @narro #javascript

    //? GETTER - GET All Technologies sorted by Date Modified
    allTechnologiesDateSorted(state) {
      return state.allTechnologies.sort((a,b) => (a.dateModified.split("-").join("") < b.dateModified.split("-").join("") ? 1 : -1));
    },
content_copyCOPY

Used in Vuex for a getter sorting by date

https://flaviocopes.com/how-to-sort-array-of-objects-by-property-javascript/