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

216
Views
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
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!