Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

157
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda