I am currently working with momentjs and moment-range to show the range between two dates in an array, this is my code:
var start = moment("2017-01-03", 'YYYY-MM-DD').format('YYYY-MM-DD');
var end = moment("2017-01-13", 'YYYY-MM-DD').format('YYYY-MM-DD');
var rangoFechas = moment().range(start,end);
var resultado =rangoFechas.toArray('days');
for(var i = 0; i < resultado.length; i++){
var dia=resultado[i].format('dddd, D/MMMM/YYYY');
console.log(dia)
}
Now I have to implement the same logic but instead of dates I have to put hours, I tried the following:
var start = moment("15:00:00", 'HH:mm:ss').format('HH:mm:ss');
var end = moment("19:00:00", 'HH:mm:ss').format('HH:mm:ss');
var rangoHoras = moment().range(start,end);
var resultado =rangoHoras.toArray('hours'); //será hours?
for(var i = 0; i < resultado.length; i++){
var hora=resultado[i].format('HH:mm');
console.log(hora)
}
And the truth is that I could not get anything. How can I solve it?. Thank you in advance