Parallels: Date and Date Range Transformer (Now with Video Demos! 🎉)

Update note: Just pushed Parallels version 1.0.14, which gives a bunch of upgrades to the Action previously known as “Construct Date in Zone”. (I had snuck that action in to 1.0.11 - which added IANA Timezone menu stuff - but hadn’t fully completed it.)

Now called “Construct Date/Date Range in Zone”, this action allows you to construct a date in an arbitrary zone using a similar interface to Luxon’s “Construct Date/Time from Object” API, which is quite powerful.

(You can do fairly abstract things like get the ISO starting date of some arbitrary year, for example - as shown in the demo below. Or you can just specify month, day, year, and time parameters [if desired]. Fields you leave empty default to sensible values. So, for example, you can construct the starting date of “October” of this year in some arbitrary timezone by simply setting the zone and setting the “Month” field to 10.)

The capabilities are now fully documented in the interface to this Action.

You can also now construct a range, by adding or subtracting some duration from the resulting constructed date, without having to call an additional action.

Here’s a simple demo page that shows what it can construct and what it can spit out:

Runtime: https://list-shifter-demo.bubbleapps.io/version-test/parallels-construct-date-in-zone?debug_mode=true

Editor: List-shifter-demo | Bubble Editor

This action also now supports the Parallels “AUX output” system, and allows you to push the computed values not just to the defined outputs (which include Construct: Date in Zone, Construct: Date in Zone Valid, Construct: Date in Zone Invalid Reason, Construct: Date Range in Zone, Construct: Date in Zone Timezone Used), but which also allows you to push the constructed date to an AUX date output, the constructed range to that AUX’s date range output, and the timezone used to that AUX’s label output.

1 Like

I’m hoping you can help. I’m trying to add unavailable dates to a calendar picker. What I need to do is compare the list of ranges of unavailable dates with the dates selected, which I believe I can do with the range list check, but then I need to split the bad ranges into a range of individual days, not a list of ranges. Is there anyway to do that?

Greetings,

is there a version of this available now?

Hey @keith,

this plugin helped me to resolve an issue I was after for weeks. My app is a reservation platform and as you can only reserve full days, I use a logic that all reservation have the time 00:00:00. This led to problems when users made reservations in other timezones as the “Do a search” then didn’t return the same results for all users. From now on I will store all date/times in one timezone and use the parallel object to normalize them to the timezone of the user. Works pretty well so far!

Thanks for your support and the great explanatory videos. Much appreciated!

Best,
Felix

Hi Keith:

Bought your plugin to play around with it.

I’ve watched all the videos on this thread and have a very simple question.

In transform date range, I’ve inputted a list of ranges to transform in INPUT DATES OR RANGES.

I then input the duration I want to shift the date range in MODIFY DATE RANGES BY DURATION:

I had thought that the value from the parallels element in Transform: Date range list would give me the input shifted by the duration.

However, I only get the original date range (March 2, 2020 8:00am to March 2, 2020 12:00pm) instead of a new date range shifted by the desired duration.

I suppose I must be missing a very simple thing?

Also, love the plugins and the fun videos - installed listshifter in an app just to learn it and contributed to you at grupz since it was karma ware.

And I wondered - using Parallels, is there a possibility to subtract a list of ranges from a list of ranges and come up with the resulting new ranges? This seems to be not a straightforward thing, I suppose.

Hi @askanatty, thanks for the support! I’m not sure I understand your issue entirely, but in MODIFY DATES/RANGES BY DURATION, you don’t have a Duration Interval set. You need to select that. Also, you haven’t selected a Duration Modifier.

From your screenshot, it looks like you’re trying to change the duration by “days” but you need to select that value from the “Duration Interval” dropdown. Also, you need to select the “Duration Modifier”.

As it says in the documentation you show, ALL THREE fields must be filled out.

The idea is you want to transform some range by some duration. A duration is defined by some Interval
(a scalar numeric value like “4”) … but 4 what? Four days? Four seconds? … that’s what the Duration Interval tells the plugin. (If you select “days” there, your interval is now “4 days” for example).

And then, “what do we want to do with those 4 days?” Is answered by the third field, “Date Modifier”.

Ah, it seems I misunderstood the documentation. I figured it was something simple. :slight_smile:

On my second note - would be it possible to subtract a list of booked date ranges from a list of availability ranges and return a new set of ranges of ranges? It seems this might only be done for one range? (I may be wrong.)

I really appreciate that you take time to answer questions on your plugin! Thank you for the support as well.

1 Like

Just pushed a new version of Parallels. New version 1.0.15 fixes a bug in the “Construct Ranges from Dates” Action. This is a non-breaking change and anyone can safely upgrade to this version.

The specific bug: If you tried to construct ranges by supplying lists for both the Start dates and End dates inputs, nothing would happen. It appears that I had, in fact, forgotten to write any code to handle that case! Now it actually does what you expect. Creating ranges using a single list (of either Start dates or End dates) and supplying a Duration did work correctly, however, and this has not changed.

Hello @keith ! How you doing?

Keith, I have to perform 3 date transformations and 2 searches. Image bellow:

At the moment I’m using 2 paralles to perform this.

In one Parallel I set the search 1 to the AUX 4, then the search 2 to the AUX 5.

Then I perform 3 transformations and set them to AUX 1, 2 and 3.

The second Parallel I’m just using because I ran of AUXs.
I’m using it’s Aux 2, 3 and 4 to perform merges and minus list with the firt paralles’s AUX.

I’m getting the desired result with this setup, but I’m wondering if I’m doing it the best way.

Wondering if I should use more parallels to perform the transformations in separate workflows, or if I sould split this workflow in some way (using the triggers when transformation is done or when Aux state is set, for exemple ). Not sure.

Do you have any recomendation for it?

Thanks!

Yeah, you’re doing it the right way, basically. You can split your workflow into multiple workflows if you need to and trigger on the Set Aux # Complete trigger as appropriate.

1 Like

UPDATE TIME: Just published Parallels version 1.0.17, which adds an option to provide a LIST of Durations to the Transform Dates action (instead of a scalar Duration). This field accepts a list of numbers, which represent the length of the selected Duration Intervals.

In the Transform Dates action, you’ll find a new field to supply a list of durations:

Hello @keith ,

I have a last technical constraint that I can’t solve.

I’m using your parallels plugin to transform a date range list and it works perfectly well.

However, another type of data was attached to this date range list (before modification by parallels) and it is impossible for me to retrieve these elements.

To explain.

I have a list of events. In this data type “event” I have a filed “date range” and a field “technician”.

So a date range corresponds to a certain technician.

Thanks to your parallels plugin I can modify a date range list coming from a list of events. But unfortunately once transformed with parallels, I can’t find any way to link this new transformed date range list with the list of technicians belonging to the initial date range list.

I tried several things with List Shifter, I just bought your floppy plugin to try to add directly a “Range2” data list in my “Event” datatype. Or “Range2” would be the transformed date range list from Parallels. Then do a “do a search events” with Range2 as a filter. But i cant use the Add RAM List Value(s) action because this is not same data type between event and date range.

Do you have an idea how i can achieve this ?

With floppy or ListShifter ? (I need to be able to link the new date ranges created with Parallels and the technicians belonging to the old date ranges).

Thanks in advance,

Hey @Dimo - answered you over here.

Update time: Realized yesterday that Bubble definitely no longer attempts to minify plugin code when new versions are pushed. So I just pushed version 1.0.18, which minifies the main plugin code (saving 50kb over the unminified version). Recommended update, but adds no new feature/function over version 1.0.17 but why ship all those unneeded bits, yeah?

Hi @keith :wave:,

Just curious, does your plugin fit this particular use case?

Hey @johnny - Well, I try not to write plugins that duplicate Bubble functionality. If you have a list of dates (I know by this you mean a list of date objects that represent a day - which we do typically by specifying the start of the day [12 AM in some such timezone on some such day]) and you want to return a list of dates in that list that happen on some certain day in that timezone, that’s a filter operation.

As in your example: In this list of dates I only want the ones that happen on Tuesday or Thursday. That’s just an advanced filter, where the 0-based day number is 2 or 4.

We can use :extract on dates to get the 0-based day number in some specified timezone. (0 = Sunday, 1 = Monday, etc.).

So, all dates that happen on Tuesday or Thursday would be a filter like:

My List of Dates:filtered (This date:extract day is 2) or (This date:extract day is 4)

And, in the browser, we see this:

Now, the part that Bubble doesn’t have is that it doesn’t have a facility for subdividing a date range into component parts. And this is a feature of Parallels (it can take a date range and split that into any arbitrary list of subdivisions – so, for example, a range into the component “days”, but it could also split that range into subdivisions of any arbitrary time unit, such as “7 minutes”).

There are other plugins that can do this as well, but Parallels is a great solution for that. However, Calendar Grid Pro also does this (as you can see from the screen shot) upon picking a range (and has a utility function for splitting dates like this as well). There are also free solutions that do this sort of date range → arbitrary date component splitting. But all of them that I’ve seen use the now-deprecated moment library, which is pretty heavy. Parallels uses the luxon library (currently version 1), but it’s a lot less heavy than moment.

(The action for this is called “Split Range” or something like that.)

2 Likes

Hey @keith,

Thanks for the detailed explanation-- this makes sense! I should’ve purchased your Calendar plugin vs. AirCalendar! :pensive:

Hey @keith,

I bought your plugin earlier today and I’m still having a hard time understanding how to convert a date range to a list of single dates (day).

Where can I find information about this?

Thanks!

Hi @p.daponte, thanks for using Parallels! The Action you’re looking for is Split/Construct Ranges. You’ll find pretty extensive documentation for it in that action’s interface (and click the “show documentation” links under individual fields). Looks like this:

Here’s an (unfortunately a bit messy) demo page that the screenshot is from. In this page, when you enter a date range by picking two dates in these standard date pickers…

… that will cause Split/Construct Ranges to run (because it causes Parallels’s update function to run, but you could of course trigger Split from any event).

And then, in the text section below, the split date range info appears. In this demo, I’m splitting the range by days (as you desire to do):

Demo here: https://list-shifter-demo.bubbleapps.io/version-test/parallels-demo?debug_mode=true

Hi keith,

I am using Parallels in conjunction with TopCal plugin, and the fact that Parallels is using Luxon version prior to 2.x is causing a conflict with TopCal, is it possible to update it? Otherwise, I will need to redo my whole system.

Thx
Elmo