此代码正常运行:
var start = moment([2017, 10, 5]);
var end = moment([2017, 10, 10]);
var result = end.from(start);
console.log(result)
<script src="https://momentjs.com/downloads/moment-with-locales.min.js"></script>
使用此代码,我希望得到与上面代码相同的结果:
var start_input = "05.10.2017";
var end_input= "10.10.2017";
var start = moment(start_input, 'DD.MM.YYYY').toDate();
var end = moment(end_input, 'DD.MM.YYYY').toDate();
var result = end.from(start);
console.log(result)
<script src="https://momentjs.com/downloads/moment-with-locales.min.js"></script>
但是有一个错误......