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

210
Views
¿Cómo obtener un rango de tiempo API en Angular?

Tengo un objeto en el que recibo un rango de horas, ese rango de horas en el frontend hay que filtrarlo en base a un lugar y en base a días.

Este es el objeto:

 Schedules: { 0: days: { 0: "MO" 1: "TU" 2: "WE" 3: "TH" 4: "FR" length: 5} finalTimeStr: "05:00 pm" initialTimeStr: "01:00 pm" _id: "600b073094a6a36dc548dd79"}

Funciona así: El usuario elige un lugar donde quiere hacer su cita, luego dependiendo del lugar se filtrará un rango de horario de 13:00 a 17:00 y si cambia de lugar será filtrado en el horario de ese lugar.

Otra cosa a tener en cuenta es que, por ejemplo, si el calendario de fechas tiene que atender de lunes a viernes, el lunes el horario empezaría de 6:00 a 13:00, pero el viernes empezaría de 9. :00 am a 5:00 pm.

¿Cómo puedo hacerlo?

Tengo este método para filtrar el calendario:

 dateFilter = (date: Date) => { // if (this.place.floor == null) { // // return false; // } let currentDay = new Date; currentDay.setDate(currentDay.getDate() - 1) if (date < currentDay) { return false; } if (this.selectedPlace.schedules.some((schedule: any) => schedule.days.some((day: String) => { return day === DaysOfWeek[date.getDay()]; // DaysOfWeek[( as number)] === DaysOfWeek[date.getDay()] } ))) { return true; } return false; } onClickNext() { this.dataEntrante = this.place; // console.log('entrante', this.dataEntrante); this.serviceatClinic.disparadorHandClick.emit({data: this.dataEntrante}) this.router.navigate(['../appointmentAtClinicHour'], { relativeTo: this._activedRoute }); } } enum DaysOfWeek { "MO" = 1, "TU" = 2, "WE" = 3, "TH" = 4, "FR" = 5, "SA" = 6, "SU" = 7, }
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!