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

222
Vistas
JavaScript, difference between date strings

I’m aware of doing this with a library in order to find the current date and use an integer to find the next date, but I’m trying to find the number of days between two date strings in this format

Date1.value = ‘2022-02-22’;
Date2.value = ‘2022-03-01’;

Is there a library I need for this or could I do it with vanilla JS

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

checkout https://github.com/you-dont-need/You-Dont-Need-Momentjs#difference

let a = Math.ceil(
  (new Date('2022-03-01') - new Date('2022-02-22')) / 1000 / 60 / 60 / 24
);

console.log(a)

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