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

137
Views
Limit the Two DatePicker within a month using Bootstrap DateTimePicker in Javascript

How to select the two datepicker within a month?

I'm currently using JavaScript and Bootstrap Datepicker.

I found a working two datepicker limit within a month but not working in bootstrap-datepicker because he use other datepicker plugin.

Here's the link http://jsfiddle.net/cse_tushar/2s8XL/

Here's my code.

  $(document).ready(function() {
    $('.startDateTime').datetimepicker({
      format: 'MMMM DD, YYYY',
      icons: {
        previous: "fa fa-chevron-left",
        next: "fa fa-chevron-right",
      },
    });

    $('.endDateTime').datetimepicker({
      format: 'MMMM DD, YYYY',
      icons: {
        previous: "fa fa-chevron-left",
        next: "fa fa-chevron-right",
      },
    });
    
     $(".startDateTime").on("dp.change", function(e) {
      $('.endDateTime').data("DateTimePicker").minDate(e.date);
    });

    $(".endDateTime").on("dp.change", function(e) {
      $('.startDateTime').data("DateTimePicker").maxDate(e.date);
    });
    
  });
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/css/bootstrap-datetimepicker.min.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/js/bootstrap-datetimepicker.min.js"></script>


<input type="text" id="from_period" class="form-control startDateTime" placeholder="FROM" style="font-weight: bold;">
  
  
 <input type="text" id="to_period" class="form-control endDateTime" placeholder="TO" style="font-weight: bold;">

about 4 years ago · Santiago Gelvez
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!