Bootstrap 4 Date picker

Bootstrap 4 Date picker form component

Bootstrap date picker is a plugin that adds a function of selecting time without the necessity of using custom JavaScript code.


Basic Bootstrap 4 version

        
            
      <div id="date-picker-example" class="md-form md-outline input-with-post-icon datepicker">
        <input placeholder="Select date" type="text" id="example" class="form-control">
        <label for="example">Try me...</label>
        <i class="fas fa-calendar input-prefix" tabindex=0></i>
      </div>
      
        
    
        
            
      // Data Picker Initialization
      $('.datepicker').datepicker();
      
        
    

Above is an example template for a Date picker in the Bootstrap 4 version based on jQuery. V4 is an older version of Bootstrap and we discourage implementing it in new projects.

Below you will find the same component but in the latest, more modern Bootstrap 5. We encourage you to use the v5 version instead, the v5 is more lightweight, more reliable and based on pure JavaScript instead of jQuery.

This page only compares the two version, you can find full documentation - with multiple options & API details via one of the links below:
Bootstrap v5 - full documentation Bootstrap v4 - full documentation

Basic Bootstrap 5 version

        
            
      <div data-mdb-input-init class="form-outline datepicker">
        <input type="text" class="form-control" id="exampleDatepicker1" />
        <label for="exampleDatepicker1" class="form-label">Select a date</label>
      </div>