5 months ago

Help with booking system timezone offsets

Posted 5 months ago by timgavin

A client ordered a booking system: they wanted a seven day schedule (Mon-Sun) that would allow for people to book an hour on each day. This system is global, so it's based on UTC.

Basically, the user picks a day - let's say Monday - and a time (12:pm EST) and reserves that block. So we store it like so:

reserved_day = 1;
reserved_time = 5:00:00

Day 1 = Monday

5:00:00 = 12:pm EST UTC.

So this means if you're in the America/Los_Angeles time zone, you'd see this as 9:00 am Monday. It's working as it should.

Keep in mind this is not a calendar app; there are only 168 blocks of time available to book (24 hours in a day * 7 days), so Monday has 24 blocks, Tuesday has 24 blocks, etc.

Now here's the rub: if someone books in Asia, where it's a day ahead, should the app be able to reflect that? So if someone in Bangkok registers on a Monday, should a person in Chicago see that as a reserved time on Tuesday? Or should they see it as reserved time on Monday?

If you think they should see it on a Tuesday, how is this accomplished? Carbon timezone only seems to do the hours, not the days.

Please sign in or create an account to participate in this conversation.