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

155
Views
no se pueden comparar los tiempos antes y después de la medianoche

Estoy tratando de comparar tiempos antes y después de la medianoche, sin embargo, después de la medianoche, la verificación falla.

Lo que quiero hacer es verificar si la hora es entre las 11 p. m. y las 6 a. m.

Esto es con lo que estoy trabajando

 // Hours const start = 23 * 60 + 0; const end = 6 * 60 + 0; // Get todays date 11pm const now = new Date(); // Check tomorrow for 6am const nextDay = new Date(now.getTime() + 86400000); const time_today = now.getHours() * 60 + now.getMinutes(); const time_tomorrow = nextDay.getHours() * 60 + nextDay.getMinutes(); if (time_today >= start && time_tomorrow < end) { return interaction.reply({content: `You cannot do that until 6am.`, ephemeral: true}) }

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Ya que tiene now.getHours() , ¿por qué no simplemente verificar si es entre las 11 p. m. y las 6 a. m.?

 const hours = now.getHours(); if (hours < 6 || hours==23){ return interaction.reply({content: `You cannot do that until 6am.`, ephemeral: true}); }
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!