End of month a new date calculate
Hi,
If the first date, for example, is 27/11/2017 (dtmmaa),
the new calculated date (DTSCADX) must give me 30/11/2022.
Currently the new date (DTSCADX) me since 27/11/2022.
Thanks:
<script type="text/javascript">
- $(function() {
$('.dtmmaa').datepicker({
monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],
startView: "months",
format: 'dd/mm/yyyy',
language: "it",
todayHighlight: true,
}).on('changeDate', function(e){
var newData = new Date(new Date(e.date).setYear(e.date.getFullYear()+5));
var dd = newData.getDate();
if(dd < 10){dd = '0'.concat(dd)}
if((newData.getMonth()+1) < 10){var mm = '0'.concat(newData.getMonth()+1);}else{var mm = newData.getMonth()+1;}
//var mm = newData.getMonth()+1;
var yyyy = newData.getFullYear();
var newData = dd+'/'+mm+'/'+yyyy;
$('input[name=DTSCADX]').val(newData);
$(this).datepicker('hide');
});
$('input[name=DTSCADX]').prop('readonly', true);
});
</script>