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

113
Views
Store current time and check it is in range or not in Luxon js

I am using Luxon and passing different timezones via html code. I want to store current time in variable and to check time is in range or not. I have three times. One for opening office time, lunch time and last closing time.

For instance Opening time : 09:15 to 12:59 pm Lunch Time : 01:00 Pm to 02:00 Pm Closing time : 02:01 pm to 4:30 pm

When time fall in this ranges, status get automatically change (Open, Lunch, Close)

With hour only not helping, i need whole time in current date.

Kindly help me. Any type of guidance would be appreciated.

const locations = document.querySelectorAll("section.Timezone div")

const updateTimes = function () {
  locations.forEach(location => {
    const output = location.querySelector("output")
    const timezone = location.getAttribute("Country_Timezone")
    const now = luxon.DateTime.now().setZone(timezone)

    output.innerHTML = now.toFormat("HH:mm:ss")

    const hour = parseInt(now.toFormat("H"))
    if(hour >=9 && hour <18)
    {
      location.classList.add("open")
    }
  })
}

updateTimes() 

setInterval(function () {
  updateTimes()
}, 1000)`
about 4 years ago · Juan Pablo Isaza
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!