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

245
Views
Set default time in Flatpickr minus 1 month

I have this code which I use into React app.

<Flatpickr options={{
   enableTime: true,
   dateFormat: "Y-m-d H:i",
 }}
 id="fromDate"
 value={dateFrom.getTime() === 0 ? '' : dateFrom}
 onChange={([date]) => {
 setDateFrom(date);
 }}
 />

How I can set the default time 1 month before the current time when the page is loaded?

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

0

From the official docs, you can see that there is an option called "defaultDate", you can set it using moment like so:

const defaultDate = moment().add(-30, 'days').toDate();
// ...
<Flatpickr 
  // ...
  options={{
    defaultDate: defaultDate,
  // ...
  }}
/>
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!