Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

204
Visualizações
How to get an API time range in Angular?

I have an object in which I receive a range of hours, that range of hours in the frontend must be filtered based on a place and based on days.

This is the object:

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"}

It works something like this: The user chooses a place where he wants to make his appointment, then depending on the place a range of hours will be filtered from 1:00 pm to 5:00 pm and if he changes places, it will be filtered in the schedule from that place.

Another thing to take into account is that, for example, if the calendar of dates has to attend from Monday to Friday, on Monday the schedule would start from 6:00 am to 1:00 pm, but on Friday it would begin from 9:00 am at 5:00 pm.

How can I do it?

I have this method for filter the calender:

  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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda