title: fetch the week number bootstrap datepicker
body: <p>please help me, i have searched on how to get the week number and range. I have found the following sources..<a href="https://stackoverflow.com/questions/30230615/fetch-week-number-and-week-start-end-date-using-bootstrap-datepicker">stackoverflow.com/questions/30230615/fetch-week-number-and-week-start-end-date-using-bootstrap-datepicker</a> and
  <a href="https://stackoverflow.com/questions/28713964/bootstrap-datepicker-select-entire-week-and-put-week-interval-in-input-field/34129546#34129546">Bootstrap datepicker: Select entire week and put week interval in input field</a></p>
  
  <p>I tried to play with the codes so that I could select the entire week and put week interval in input field and show the week number. But it is not working for me, can someone help me solve my problem? Please help me. Thank you in advance.</p>
  
  <p>Here are the script tags I used.</p>
  
  <pre><code> &lt;!--jquery--&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;!--bootstrap--&gt;
  &lt;link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"&gt;
  &lt;script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"&gt;&lt;/script&gt;
  
  &lt;!--datepicker--&gt;
  &lt;link href="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/css/datepicker.css" rel="stylesheet" type="text/css" /&gt;
  &lt;script src="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.js"&gt;&lt;/script&gt;
  &lt;!--moment--&gt;
  &lt;script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.11.1/moment.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/2.10.6/moment.min.js"&gt;&lt;/script&gt;
  &lt;script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Here is my html code.</p>
  
  <pre><code>&lt;div class='input-group date' id='datepicker2'&gt;
       &lt;input type='text' id='datepicker' class="form-control"  /&gt;
       &lt;span class="input-group-addon"&gt;&lt;i class="glyphicon glyphicon-calendar"&gt;&lt;/i&gt;&lt;/span&gt;
  &lt;/div&gt;
       &lt;div id="output"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>And here is my javascript..</p>
  
  <pre><code>                $('#datepicker2').on('dp.change', function (e) {
                  var kk = $('#datepicker2').val();
                  var value = $('#datepicker2').val();
  
                  var firstDate = moment(value, "MM-DD-YYYY").day(0).format("MM-DD-YYYY");
                  var lastDate =  moment(value, "MM-DD-YYYY").day(6).format("MM-DD-YYYY");
                  $('#datepicker2').val(firstDate + " - " + lastDate);
  
  
                  $("#output").html(
                  "Week Number: " + moment(kk, "DD/MM/YYYY").week() + " of " + 
                  moment(kk, "DD/MM/YYYY").weeksInYear()
                  );
  
              });
  </code></pre>