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

211
Views
Cómo filtrar una matriz de fechas usando javascript

Tengo una serie de fechas (cadenas) ordenadas, desde los días más antiguos hasta los más recientes, así:

 const allDates = [ '2020-11-21', '2020-11-22', '2020-11-23', '2020-12-21', '2020-12-22', '2020-12-23', '2021-01-21', '2021-01-22', '2021-01-23', '2021-02-21', '2021-02-22', '2021-02-23' ];

Lo que quiero crear es una nueva matriz con la fecha más antigua del mes más antiguo, cualquier fecha de los meses intermedios (podría ser la primera fecha de cada mes) y la última fecha del último mes, por lo que la nueva matriz se ve así :

 const filteredDates = ['2020-11-21', '2020-12-21', '2021-01-21', '2021-02-23']

Lo importante es que no quiero usar ninguna biblioteca 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!