Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!