for (const item of temp) { let minDate = "none" for (const day of item.dayPlan) { if (day.dayDate < minDate) { minDate = day.dayDate } } item.sortProp = `${item.team}-${minDate}` } temp = temp.sort((a: any, b: any) => { return a.sortProp.localeCompare(b.sortProp) })
const data1 = { planBeginDate: "2022-11-01", planEndDate: "2022-11-30", manufacture: [{ team: "1", styleNumber: "2", manufactureCode: "3", total: "4", po: "5", planDate: "6", productionQty: "7", dayPlan: [ { targetCapacity: "300", dayDate: "2022-11-01", }, { targetCapacity: "200", dayDate: "2022-11-05" } ] }] }