title: How to display current date on page load in bootstrap date picker
body: <p>Please find my program below,</p>
  
  <p>How to show Today's date in the div.. as per below example .. by default it show Todays date but its showing previous month to today's date... if I click on Today from drop down still it shows date from previous month to today's date. On page load itself how to show from and to date as Today's date</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;&lt;/title&gt;
          &lt;meta charset="UTF-8"&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
  &lt;!-- Include Required Prerequisites --&gt;
  &lt;script type="text/javascript" src="//cdn.jsdelivr.net/jquery/1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="//cdn.jsdelivr.net/momentjs/latest/moment.min.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap/latest/css/bootstrap.css" /&gt;
  
  &lt;!-- Include Date Range Picker --&gt;
  &lt;script type="text/javascript" src="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.css" /&gt;        
  
  &lt;script type="text/javascript"&gt;
  $(function() {
  
      function cb(start, end) {
          $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
          //alert($('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY')));
      }
      cb(moment().subtract(29, 'days'), moment());
  
      $('#reportrange').daterangepicker({
          ranges: {
             'Today': [moment(), moment()],
             'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
             'Last 7 Days': [moment().subtract(6, 'days'), moment()],
             'Last 30 Days': [moment().subtract(29, 'days'), moment()],
             'This Month': [moment().startOf('month'), moment().endOf('month')],
             'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
          }
      }, cb);
  
  });
  &lt;/script&gt;        
  
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div id="reportrange" class="pull-left" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 20%"&gt;
              &lt;i class="glyphicon glyphicon-calendar fa fa-calendar"&gt;&lt;/i&gt;&amp;nbsp;
              &lt;span&gt;&lt;/span&gt; &lt;b class="caret"&gt;&lt;/b&gt;
  
  
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ftNuI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ftNuI.png" alt="enter image description here"></a></p>