Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

145
Visualizações
Is there a way to select items from an array based on time passed?

I am building a day calendar. It has 8 boxes each representing an hour. I would like the the boxes in the past greyed out using moment. What I am thinking so far is this here:

var greyedOut = ["nine", "ten", "eleven", "twelve", "thirteen", "fourteen",
  "fifteen", "sixteen", "seventeen"
]
var selected = [];

greyedOut.forEach(function(check) {
  selected.push(check)
})

console.log(selected);

if (moment().isAfter(moment(check))) {
  $()
};

var check = moment.duration(8, 'hours').asMinutes();
console.log(check);

let divvy = [480 / 8, 60 / 8];
console.log(divvy);

Thank you for any input or advice

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Your question isn't very clear, but maybe this is close to what you want.

greyedOut.forEach(function(check) {
  if (moment().isAfter(moment(check))) {
    $("#" + check).css("background-color", "grey");
  } else {
    selected.push(check);
  }
});

console.log(selected);

The test of moment(check) needs to be inside the loop.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda