0
<div class="input-group" id="DateDemo">
<input type='text' id='weeklyDatePicker' placeholder="Select Week" />
</div>
$(document).ready(function(){
$("#weeklyDatePicker").datepicker({
format: 'dd/mm/yyyy'
});
$('#weeklyDatePicker').change(function(event) {
var value = $("#weeklyDatePicker").val();
var firstDate = moment(value, "D/mm/Y").day(0).format("D/mm/Y");
console.log(firstDate);
var lastDate = moment(value, "D/mm/Y").day(6).format("D/mm/Y");
$("#weeklyDatePicker").val(firstDate + " - " + lastDate);
});
});
I am wanting to catch the interval of a week with jquery using the plugin Moment().
Ex: Assuming that my Sunday of my week starts 01 and goes until Saturday day 07. When I select a date in that range it gives me the day it starts and ends this week.