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

77
Views
Extensión de día - momento js

Hay un servicio que abre y cierra los días de la semana (por ejemplo: lunes de 22:00 a 01:20, martes: de 04:00 a 13:00, miércoles: de 17:00 a 21:00). ..). Por el momento mi código funciona, así que digamos que hoy es lunes y la hora es a las 23:58: el servicio se está ejecutando... la hora es a las 00:00, el servicio no funciona y se abrirá a las 04:00... (la hora desde 00:00 a 01:20 no es fijo porque el día ya es martes y la fecha está cambiando). Necesito algún tipo de solución de bandera que no cambie el día y mantenga el servicio abierto hasta la 01:20 y cerrado hasta las 04:00

datos de la consola - hora de inicio - hora de finalización

Ajustes de hora

 let startTime = moment(foundScheduleItem.open_at, 'HH:mm') let endTime = moment(foundScheduleItem.close_at, 'HH:mm') const afterStart = moment().isSameOrAfter(startTime) const isToday = afterStart && moment().isSameOrAfter(moment('00:00', 'HH:mm')) const beforeClose = moment().isSameOrBefore(endTime) if (service.extended) { // extended - флаг const checkTodayBeforeMidnight = isToday && afterStart; // If more than 00:00 but less than close time we dont add the day if (!beforeClose && checkTodayBeforeMidnight) { endTime = moment('23:59', 'HH:mm'); // no work } else { startTime = moment('00:00', 'HH:mm'); } }
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!