Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
sort array date wise and map latestest date must come 1st : react js

i have this react app

i am trying to sort datas from it date wise (latest date comes top in the list )

the date is stored in two differnt pattern some are in yyyy-mm-dd and some are in dd-mm-yyyy

i am trying to sort both
where latest date comes in top of the list format

 const sortedOnDate = Object.values(groupedByDate).sort((arr1, arr2) => {
          if (arr1[0].date < arr2[0].date) {
            return -1;
          } else if (arr1[0].date > arr2[0].date) {
            return -1;
          }
          return 0;
        });

entire code i am adding in code sandbox

https://codesandbox.io/s/exciting-sea-ins4vt?file=/src/App.js

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!