I'm using a bootstrap datepicker and i want to show the result in week date format e.g 02-05-2015 - 10-05-2015 (dd-mm-yyyy)
<input style="margin-top:5px" class="form-control datepicker" />
<script type="text/javascript">
$('.datepicker').datepicker({
format: 'dd-MM-yyyy',
minViewMode: '0',
language: "vi",
autoclose: true,
selectWeek: true,
todayHighlight: true
}).on('changeDate', function (e) {
var date = e.date;
var startDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 1);
var endDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 7);
// how to output the custom date with the format 8-6-2015 - 14-6-2015
// i even try $('.datepicker').text('abc') but then it ruins the whole system
console.log(startDate.toJSON());
console.log(endDate);
console.log(e);
})
</script>
I expect to get the output result just like http://www.tikalk.com/incubator/week-picker-using-jquery-ui-datepicker/ (whole week select) right in the input control.
The whole code is here on Plunkr