Full Calendar - Using a repeating group to pull events from a specific user

Hey all!

So I’m using Full Calendar to create events for a business (user) and I’m then having them shown on a repeating group on the home page.

The home page consists of the businesses picture followed by a repeating group containing the events they have going on that day.

However, I’m having a huge headache getting the group to pull the correct events. It want’s to either pull every event on the calendar or none at all. I’ve tried dozens of tweaks to try and get the repeating group to pull the correct events with no luck

Currently the repeating group is set to “Search for events”
Constraints: “Created by = current cell’s user”
Date = Have tried many things (equating the event date to the current date/time, the calendar’s day, calendar’s day’s events, etc.)

  • I have also tried making the date “All Day” and then equating it to the current date/time with no luck as well

Has anyone ever had a similar problem or know something I don’t about working with dates? I know it is trying to pull events, because when I remove the date constraint, everything show’s up.

Relevant info:
Data Type is Event: Start = Date, End = Date, Description = text, allDay = yes/no (default yes)

No. This will never work. There’s no value in Current Cell until it’s populated with events. Did the issue checker not complain at you about that?

Constraint “Created by CURRENT USER” is what u want. You need to get your constraint conditions from OUTSIDE the RG.

So the current cell’s user is the parent group user.

The current user is whoever is seeing a list of different businesses and their calendars.

The only constraint issue is the date. When I don’t set any date constraints, the events show up just fine, the issue is that ALL of them from past present and future show up.

Actually I believe I just figured it out:
I created a text type called “dateText” under the events Data Type
When an Event is created I set a new field dateText = Calendar’s Current Day:formatted as 1/27/19 which sets the date in choosing into a text type.

Then in the repeating group I called it back as dateText = current date/time: formatted as 1/27/19 so that they are matching text fields. All appears to be working!

So constrain or filter them by what you want to show?

Yes that’s what I was attempting to do before, but trying to constrain to show only the events happening today was the issue.

Depending on what that constraint requires you may have to use :filter Advanced condition to iterate over the list of Events (“This Event’s start date is some_condition” or “such and such a range contains point this Event’s start date” as examples.)

Ah. The simplest and most performant way to identify if two date objects share the same “date part” (as you might call it) is textwise (this is a special case of date comparisons and not generally true of date evaluations – most should be performed datewise):

date1:formatted as MM/DD/YYYY (some_timezone) is date2:formatted as MM/DD/YYYY (some_timezone)

… will be true if date1 and date2 happened on the same date. The :formatted as parameters following date1 and date2 must be identical for this to work properly. It does not matter which timezone you select, just that they be the same. So you can use User’s Timezone or a static timezone of your choice.

Example:

date1 is January 28th 2019 at Noon in America/Los Angeles
date2 is January 28th 2019 at 1:22 PM in America/New York (aka January 28th 2019 at 4:22 PM in America/Los Angeles)

Let us say that Current User’s browser believes it is in America/Los Angeles.

date1:formatted as MM-DD-YYYY in Current User's Timezone

… resolves to a string: “01-28-2019”

date2:formatted as MM-DD-YYYY in Current User's Timezone

… resolves to a string: “01-28-2019”

These strings are the same, so

date1:formatted as MM-DD-YYYY in Current User's Timezone is date2:formatted as MM-DD-YYYY in Current User's Timezone

… resolves to the Boolean (“yes/no”) value yes/true. Indicating that these date/times happened on what we think of as “the same day”.

Wow, thanks for the explanation!

For my purposes, everything should be happening within the same time zone (it’s all based by city), so I think we are good here for now.

Out of curiosity, is there a better way you can think to do it that doesn’t rely on converting the date to a string?

Yes, but it’s brain damaging to do in Bubble and I do not believe it is more performant. (Source: my app does gazillions of these computations and the datewise way is slower in Bubble.)

But here’s how:

In datewise terms, what does it mean for two dates objects date1 and date2 (remember that the date data type describes a specific moment in time) to happen on the same day?

Well, it means that one date (let’s say date1) is within the range defined by the start of date2 and the end of date2. (We could also say it means that date2 is within the range defined by the start of date1 and the end of date1.)

What is the start of date2? The start of date2 is date2 with all of its time parts set to 0 (time: 00:00:00.000).

What is the end of date 2? The end of date2 is date2 with its time parts set to 23:59:59.999 (23 hours, 59 minutes, 59 seconds and 999 milliseconds).

So let’s try to build that range from start of date2 to end of date2 in Bubble so that we can range contains point date1… shall we? Here we go!:

Well, SHOOT. We can only do math in one swoop on the left hand side of the ← range → constructor. We would have to do the range construction in 2 steps. I’m not even going to show that as I’m sure you get the idea.

By the time we construct date2’s start and date2’s end and then construct the range defined by those points, the simple textwise evaluation is done and our workflow is moving on.