0

code looks like this

const data = [
    {
        "photocard":{"name":"Bang chan Double Sided #2 Photocard","group":"Stray Kids","member":"Bang Chan","album":"GO生(GO LIVE)"},
        "listedFor":{"trading":{"want":"123"}},
        "_id":"60872c55590c1a3a30b2c00b",
        "location":"123",
        "shipTo":"123",
        "description":"123",
        "posted":"2021-04-26T21:10:45.103Z",
        "__v":0
    },
    {
        "photocard":{"name":"Bang chan Double Sided #2 Photocard","group":"Stray Kids","member":"Bang Chan","album":"GO生(GO LIVE)"},
        "listedFor":{"trading":{"want":"999"}},
        "_id":"608999da42a26146889d7bb3",
        "location":"999",
        "shipTo":"999",
        "description":"999",
        "posted":"2021-04-28T17:22:34.047Z",
        "image":"",
        "__v":0}
    
]

const newData = [...data].sort((a, b) => {
        return b["shipTo"] < a["shipTo"]
        //return b.shipTo < a.shipTo
    })
console.log(newData)

it doesnt change sorting in either way (change (a,b) to (b,a), so i think something is wrong with the sorting method, however it was working a while ago with different structured data

0 Answers0