I am trying to find ranges between two given hours, in If what I want is to do the following:
I have h1 = 20:00:00 and h2 = 20:30:00
What I want is for the final result to equal this:
20: 00: 00--20: 10: 00--20: 20: 00--20: 30: 00 This means adding 10 minutes to the given time
This is my code:
.controller('General', function($scope){
$scope.h1=moment("18:00:00",'HH,mm,ss').format('HH-mm-ss');
$scope.h2=moment("21:00:00",'HH,mm,ss').format('HH-mm-ss');
var rangoMinutos = function(h1, h2) {
var rango= [];
while (h1 <= h2) {
rango.push(h1);
h1.add(1,'hours');//NO SE SI ESTE BIEN ESTO
}
return rango;
};
var results1 = rangoMinutos($scope.h1, $scope.h2);
alert(results1)//ver resultado de los rangos
})