Hello,
i am working on a calendar interaction module. the calendar shows days reserved. a reservation interval is 7 days. i have set up via javascript that hovering a day adds a class and auto-hovers 3 days before and 3 days after this day too to visualize the 7-day-interval setting that class there too. now i stuck with the following problem.
if i hover a day and one of the prev. 3 or next 3 is already part of a reservation i want to prepend the difference to the other end of the 7-day interval. an example:
- i hover day 12
- then the interval looks like xxx12xxx
- i move the cursor to 13
- the interval looks like xxx13xxx
- if i now move the cursor to 14 then 15,16,17 would be marked too, but what if 16 is the starting point of a reservation? then it would look like xxx14x
- In either case i finally need to know the id of the left and right outer end as these are values i have to send via form. how to get these?
- how to make that the difference (16 and 17) is getting prepended on the left end so it would look like xxxxx14x?
the only way i see it to have a 7 cases switch with a huge code block. but somehow i feel there was an easier way.
can you guys probably show me?
many thanks in advance for reading!
regards