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

265
Views
Flatpickr: Auto-Add Delimiter when Typing Date

Is there a built-in way for Flatpickr to automatically add a delimiter when a user is manually typing a date in to the input field?

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

0

You can do it using jQuery masking function for this.

Example:

$(document).ready(function() {
  const flatpickr_time = $('#flatpickr_time').flatpickr({
    allowInput: true,
    dateFormat: 'd/m/Y'
  });

  $('#flatpickr_time').mask("99/99/9999");
  $('#flatpickr_time').change(function() {
    if ($(this).val().substring(0, 2) > 12 || $(this).val().substring(0, 2) == "00") {
      console.log("Wrong month format");
      return false;
    }
    if ($(this).val().substring(3, 5) > 31 || $(this).val().substring(0, 2) == "00") {
      console.log("Wrong date format");
      return false;
    }
  });
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/flatpickr/4.6.11/flatpickr.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.maskedinput/1.4.1/jquery.maskedinput.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/flatpickr/4.6.11/flatpickr.min.js"></script>

<input id="flatpickr_time" style="width:200px;">

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!