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

217
Visualizações
React date-picker set a previous date from selected date

I just started learning front-end technologies (React) and facing an issue with react date picker API.

Whenever I select a date from the UI, it displays correctly on the UI but when I bind the date to send it over to the server to save the record, it sends a previous date with a timestamp.

enter image description here

For example: If I select today's date i.e. 14 April 2022 from the UI, the actual date is bonded something like 13 April 2022T06:33:11.

dob: "2022-04-13T18:30:00.000Z"

I have tried to debug the issue but did find anything relevant, but when I console.log the date, it prints the same date as selected from the UI.

Here is the code that I implement for data picker.

import DatePicker from "react-datepicker";

const [dob, setDob] = useState("");

<DatePicker
  className="form-control" 
  minDate={new Date("1945/08/15")}
  maxDate={new Date()}
  selected={dob}
  onChange={(date) => setDob(date)}
  showMonthDropdown
  showYearDropdown
  dropdownMode="select"  

/>

What's wrong with my code?

about 4 years ago · Juan Pablo Isaza
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