After reading this article you'll learn how to:
Install the date/time offset step from the block store
Configure the date/time offset step
The date/time offset step is created by Betty Blocks, but it's not readily available in the standard set of steps within the action builder. But that doesn't matter, you can find it and install it from the block store. To do this navigate to the block store and search for 'offset' it will pop up as the first hit.
view details to check out what the block is about. In our case, the step will explain that you can add or subtract for example days or hours. This tab also lets you install the block into one of your applications. Simply hit the
Install block button and select your organization followed by your application.
After installing the 'date/time offset' step, it can be found in your action builder of the application that was selected. You'll find it in the miscellaneous section of the action steps.
Configuring the step
For this example, I'll use the same use case used in the Using the generate UUID step. The only thing that we'll add for this use case is the following property:
Date 'Expiration date', required
Just like the article linked above; a page is created that allows a user to generate a coupon.
When we check out the action behind the form, more specifically the date/time offset step within the action it'll look like this:
In this example we want a coupon to expire after 6 months. In order to do this we selected the checkbox to use the current time/date. We then select month as the offset and gave it the value 6; so 6 months. Select what type the result needs to be, this has to be the same as the property you want to save the data to, so select date time if that's the property type you use within your model.
The last and crucial step is to define which timezone we're dealing with, this is based on the location where your application is hosted. In this example, my application si hosted in the NL3 zone, so I selected UTC +1, but if you have an application in the zone USA2 then you need to select UTC -6 here. To see where your application's zone is located check my.bettyblocks.com and go to your application's overview to see the zone's location.
After creating a new coupon (the day of writing this article it is March 13th 2023) it should say September 13th 2023, so 6 months from now.
And there we go, the expiration date is September 13th, as we expected. Of course you can be more specific than skipping 3 months, this step also works with time for example.