我将脚本添加到数据选择器
<script>
$(function() {
$( "#from" ).datepicker({
dateFormat: 'dd-mm-yy',
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1,
onClose: function( selectedDate ) {
$( "#to" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#to" ).datepicker({
dateFormat: 'dd-mm-yy',
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1,
onClose: function( selectedDate ) {
$( "#from" ).datepicker( "option", "maxDate", selectedDate );
}
});
});
</script>
以及日期差异的脚本
<script type="text/javascript">
function startEndDate() {
from= document.modpren.from.value; //prima data la prende vuota
to= document.modpren.to.value; //seconda data
var fromArray = from.split('/');
fromdate = new Date(fromArray[2], fromArray[1]-1, fromArray[0]);
var toArray = to.split('/');
todate = new Date(toArray[2], toArray[1]-1, toArray[0]);
alert ((todate-fromdate)/86400000);
}
</script>
问题是在“giorni”中没有写出两个日期之间的日子。
<input type="number" name="giorni" id="giorni" value="" >
有人能帮我吗?我查看了另一篇文章,但我没有找到解决方案非常感谢