I'm using moment.js and trying to process a date using that code
function toISOdate (date) {
return moment(date, 'DD.MM.YYYY').toISOString()
}
function toMomentDate (date) {
return moment(date)
}
let input = "25.11.2017-25.11.2017"
let dateArray = input
.split('-')
.forEach(toISOdate)
console.log(dateArray, input)
But the problem is that dateArray returns undefined. Maybe it's very obvious mistake, but I can't find it.