Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

376
Visualizações
JS how to add hours and minutes to scheduled date

I need to be able to let clients schedule a certain type of meeting for a future date, the meeting duration I get back from the database is in minutes. I need to be able to create a future start date and time, then add the duration minutes to that time and get the end date and time. Then convert those two to utc time and iso format to send to backend. I know how to convert to utc and iso, just not sure of the best way to add times with the duration being in minutes. Any one know the best way to do this with javascripts date api, moment.js or another library?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

I like to approach problems with time using the date-fns library. Today the Date object solves "most" of our problems so date-fns helps giving useful functions to manipulate dates.

What you might be looking for is the add minutes function. Also the formatISO might help.

For UTC, the UTC method should work fine.

about 4 years ago · Juan Pablo Isaza Relatório

0

With the Date API, you can:

// hours
date.setHours(date.getHours() + someHours);
// minutes
date.setMinutes(date.getMinutes() + someMinutes);
// whatever else...
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda