-1
I have a method that generates an array of number time and string time, one to show in the table and one to send in the json. The point is I’d like to include 01:00 / 01:30 - 02:00 so on.
function listaHorasDia() {
var horas= [];
for (var h = scope.horaInicio; h < (scope.horaFinal +1); h++)
horas.push({ horaNumero: h, horaExibicao: ('00' + h).substr(-2) });
return horas;
}
I would like my array to look like this
horas = [
{horaNumero:1330, horaExibicao: '01:30'},
{horaNumero:1400, horaExibicao: '14:00'}
]
and so on
Could detail better what you want to include?
– Felipe Avelar
edited the question @Felipeavelar
– Eduardo Krakhecke
But do you already get this at Scope? Or do you want the increment to be every 30 minutes?
– Felipe Avelar
on Scope I get an entire number, I would like inside the for be done that @Felipeavelar
– Eduardo Krakhecke
Wouldn’t it be the case to just add one more
push
no? In case you would add this push:horas.push({ horaNumero: h+30, horaExibicao: h.toString().substr(-2)+':30' });
?– Felipe Avelar
In that case I lose the whole hour
0: {horaNumero: 30, horaExibicao: "0:30"}
1: {horaNumero: 31, horaExibicao: "1:30"}
2: {horaNumero: 32, horaExibicao: "2:30"}
3: {horaNumero: 33, horaExibicao: "3:30"}
– Eduardo Krakhecke