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

169
Views
cómo encontrar la diferencia entre dos fechas con formato diferente en el año

Mi backend me envía el sello de fecha y hora de un documento y quiero calcular la antigüedad de ese documento en el frontend. Estoy usando el momento pero no sé cómo calcular la diferencia entre ellos.

 var TodaysDate = new Date(); //Mon May 09 2022 22:52:42 GMT+0530 (India Standard Time) var DateFromServer = Entity; // 2021-05-02T13:18:00.000Z

quiero respuesta en años como 3.4 años

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

0

Con momento puedes hacerlo así

 const TodaysDate = moment('Mon May 09 2022 22:52:42 GMT+0530'); const DateFromServer = moment('2021-05-02T13:18:00.000Z'); const diff = TodaysDate.diff(DateFromServer, 'year', true); console.log(diff.toFixed(2) + " Years");
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!