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

107
Views
Advice on Filtering Availability Based on dates

I am trying to show availability for specific resorts over the course of a month. The resorts all have different rooms and different week end days based on the room. I need to be able to show valid check in days based on availability with respect to their week end days.

That probably does not make too much sense so let me elaborate. Let's assume person A wants to book a room for 3 days. In order for a check in day to be valid the room has to have continuous availability (I.E. Available 05/03, 05/06, 05/07, and 05/08 -The check in day does not count towards the three day stay). In order for the check in day to be valid it also must respect the week end day. For example Let's assume the person wants to book a 3 day stay in a one bedroom unit with a week end day of Saturday. Assuming continuous availability this would mean that valid check in days would be the following: (Saturday, Sunday, Monday, Tuesday, and Wendsday) and we would need to filter out availability on Thursday and Friday

This is where I am struggling a bit. The API endpoint that I am calling returns availability as datetime strings. I originally thought that I could just call the Date.getDay() function on the Date and then check if the week end date was greater than the day + duration of stay. However the getDay function returns 0 for Sunday, 1 for Monday, etc. so most numbers would be greater than these days. For instance if the week end day is a Sunday any number would be greater than 0 and therefore the room would show no availability.

Another option I thought of was to create a hashgraph with all the possible combination of days, but this would be a lot of work so I would like to avoid it if possible. I am hoping that there is an easy enough solution that I am not thinking of.

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!