I’m having trouble with the Calendar view in my booking app. The events are all showing up under the wrong date — for example, bookings I set for July 24 or July 31 are all appearing under Monday, July 21 (which is today ).
The date/time columns are set up correctly (Start and End), and they’re properly formatted — even though I’m using Hungarian date format, the underlying data is stored right. I’ve double-checked that they’re real date/time columns too.
But Glide still displays everything as if it’s happening today.
Anyone seen this before or know what might cause it? Would love any ideas or fixes!
You are using template columns for your Start and End dates, which end up being text instead of actual dates, so I suspect that is part of the problem because the code can’t properly determine what the date is.
Show me how the Booking Start and End columns are configured. I’m curious where those times are coming from.
The problem with dates, is that when they are converted to text, it becomes a lot more difficult to reliably convert it back to a real date. It’s further complicated because Glide will format those dates differently for different users depending on their device and browser settings. For example, the month name would show in English for me. Also, dates are usually formatted as Month/Day/Year, whereas other users around the world may see Day/Month/Year, or Year/Month/Day. There is a Text to Date column, but that is very dependent on having a date debated the same every time. It’s but always reliable.
You can try the Text to Date column, but I would at least use the short format for your date so you are only working with numbers instead of month names that are translated. I personally would not go down path though. I stay away from that column.
If it were me, I would figure out the decimal equivalent for each time slot. (ex. 9am = (9/24) or 0.375, 12pm = (12/24) or 0.5, 6:30pm = (18.5/24) or 0.77083, etc). When a user selects a time you can add the decimal to the selected date to get your Start Date and Time. Then it looks like you add 30 minutes to get the End time, so you could add (0.5/24) to the Start Date Time, which is the equivalent of 30 minutes.
Or you could take a different approach like @Darren_Murphy did in the following post.
Overall, you are trying to coax to text values to become a date value, which can be inconsistent and prone to errors. It’s better to consistently work with date types all of the time. You can easily take a date and add days or time using a math column as long as the bake you are adding is the decimal equivalent of days. One day equals 1. 12 hours equal 0.5 days. The result from a math column will remain a date type and we’ll not be affected by different regional formats.
Dates can be very complicated to work with in code because there are so many inconsistencies with them. That’s why it’s always better to keep them as date types because the underlying value is always consistent.