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

150
Views
Sorting the date string in the DD-MM-yyyy format using lodash

have a following function:

listOfTransactions.map(({ tdate='', out='', in='' }) => {

return  {
  date: '10 Feb 2022',
  out: 'AAA
  in: 'BBB'
}
})  

// Here multiple objects will be returned from here, but the format of the date will be like this only. Now, I need to sort this in a descending order , so I tried

_.sortBy(   listOfTransactions.map(({ tdate='', out='', in='' }) => {
    
    return  {
      date: '10 Feb 2022',
      out: 'AAA
      in: 'BBB'
    }
    })  , 'date')

But this is not working .So, any suggestions/ help how do I sort this?

Thanks

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

According to lodash docs you need to return the value want to sort by. Since it is specifically dates, you first need to convert them to Date objects.

_.sortBy(listOfTransactions, (transaction) => new Date(transaction.date))

I believe this should return what you need.

about 4 years ago · Juan Pablo Isaza Report
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!