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

202
Views
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
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!