search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Timeline and room planner

Asked by Aldo Bertoldini
4 years ago.

I'm trying to build a room planner with checkin/checkout time at 12.00 PM. Timelines are displayed correctly, but when I load events, events start one day before the real start date.

If you choose the double room, Marina Bach reservation is displayed starting from 16th, but her booking start on 17th. Backend data are correct, because the console log shows correctly start date as Sept 17 in the loadEvents function. It looks like it take out 12 hrs from the checkin date and add 12 hrs to the checkout date.

What's wrong?

Answer posted by Dan Letecky [DayPilot]
4 years ago.

The grid cells start at 12:00 (noon) and end at 12:00 (noon) the next day. Your events start and end at 00:00.

You need to align the start with the grid.

1. You can store the real checkin/checkout time in the database with the date (use date/time) field.
2. If you just store the dates in the database, add 12 hours before sending the data to the client side.

This is the first -12h shift. The second -12h shift happens because you are using .useEventBoxes = "Always", the default value:

You can see the real event duration highlighted by the orange/red part of the duration bar. You can see that it corresponds to the data sent from the database. The light blue part of the bar is the alignment.

If you take a look at the tutorial you will see that it uses approach #1, it stores the full date/time in the database:

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.