Skip to main content
2 de 6
Melhoria das palavras utilizadas na pergunta
user avatar
user avatar

Por favor, veja se esse código resolve:

HTML:

<div class="container">    
   <div class="row">
       <div class="col-sm-6 form-group">
        <div class="input-group" id="DateDemo">
             <input type='text' id='weeklyDatePicker' placeholder="Select Week" />
         </div>
     </div>
 </div>

JavaScript:

 $(document).ready(function(){
 
 $("#weeklyDatePicker").datetimepicker({
     format: 'DD-MM-YYYY'
 });

  //Get the value of Start and End of Week
 $('#weeklyDatePicker').on('dp.change', function (e) {
     var value = $("#weeklyDatePicker").val();
     var firstDate = moment(value, "DD-MM-YYYY").day(0).format("DD-MM-YYYY");
     var lastDate =  moment(value, "DD-MM-YYYY").day(6).format("DD-MM-YYYY");
     $("#weeklyDatePicker").val(firstDate + " - " + lastDate);
 });
});

CSS:

.bootstrap-datetimepicker-widget tr:hover {
background-color: #808080;
}

Link com o exemplo: JSFiddle

user167899