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

200
Views
Cómo verificar diffTime> Date.now para habilitar y deshabilitar un elemento
Goals: -Get stored time button was last clicked -If stored time is greater than (>) Date.now() - delay then enable the button

Necesito que este botón funcione de la siguiente manera, tenga en cuenta que esto es javascript hecho en Velo (Wix)

Haga clic en el usuario> tome la hora actual del clic en una base de datos (hecho) verifique la hora de la base de datos contra date.now y obtenga un diferencial de tiempo (hecho)

Ahora necesito escribir un if-else para habilitar y deshabilitar el botón hasta que se realice una desactivación retrasada.

Esto es lo que he escrito hasta ahora:

 $w.onReady(function () { $w.onReady( () => { $w("#dataset2").onReady( () => { const itemObj = $w("#dataset2").getCurrentItem(); const dateNow = new Date(); const updatedDate = itemObj._updatedDate; const diffTime = Math.abs(updatedDate - dateNow); const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); console.log(diffTime + "milliseconds"); }); }); console.log("Site is ready & button enabled."); }); export function button1_click_1(event) { $w('#button1').label = "Currently Occupied" if (diffTime > Date.now) { setTimeout(function() { $w("#button2").enable(); }, 20000); } else if (Date.now < diffTime) { $w('#button1').disable(); } else { $w('#button1').enable(); console.log('Button Clicked and checked.'); }}
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!