Question

Filter and format for business hours

  • 28 September 2021
  • 10 replies
  • 603 views

Hi,

 

I’m trying to setup a ZAP that will let us know if someone requests a booking that occurs outside of our business hours.  We run a coworking space and want to catch these booking so that we can contact the person.

This is not about trying to limit the time that the ZAP runs, it is about parsing the time that the booking starts and ends to make sure it is with the allowed times.

I set up a filter and have formatted the date and time.  However, when I try to compare the booking time to check to see if it is before 9:00am, it does not work because it seems when using the (Date/Time) Before or After conditional statement it requires a date AND time.

Is there a way to take only the date of the booking and concatenate 9:00AM to the end so that the comparison will work?

I can get it to work if I add another formatter that strips out the time and then use that output with the (Number) Less Than conditional statement.

I was trying to avoid doing this because it increases the tasks used from 3 to 5 to just strip out the time.

Or is there another way to do this entirely?

Thanks!


10 replies

Userlevel 7
Badge +14

Hi @namvu808 

Please post screenshots of how your Zap steps are configured as well as a specific example that you are having trouble with, thanks.


Is there a way to take only the date of the booking and concatenate 9:00AM to the end so that the comparison will work?
You can add dynamic and static variables to a Zap step field.
 

Formatter steps can be used to parse data: https://zapier.com/apps/formatter/help

Code steps can be used to parse data: https://zapier.com/apps/code/help

Here’s the setup:

Reformat the Start Date/Time:

 

Reformat the End Date/TIme:

 

Filter to see if booking is outside of normal business hours. In this case, the booking was to end at 11:00am, but the filter said there was a match and let the ZAP complete when it should have stopped it.

 

Userlevel 7
Badge +14

@namvu808

Check out this help article: https://zapier.com/help/doc/use-filters-so-your-zap-only-triggers-certain-daystimes

 

Filtering Between Certain Dates and Times

If your Trigger sends along a date and time field, you can use the "After Date/Time" and "Before Date/Time" filters to specify a date and time range.
The tricky part to remember is that the Date/Time filter is going to look for a full date and time - you can't specify one or the other.

In this example, the Zap will only continue to the next step if the Trigger was updated between 2015-08-15 3:00 AM and 2015-08-25 7:00 AM.

date and time range in a filter

 

It’s also a best practice to set these 2 options on the Formatter steps.

 

Userlevel 7
Badge +14

@namvu808 

You may want to consider using 2 Filters

First Filter to check if Sat OR Sun

Second Filter to check if Start/End “contains” any of these values using OR conditions:

00:00

...

09:00

 

17:00

...

23:00

 

NOTE: There are more advanced approaches to handling this by using a Code step to save Zap steps/tasks: https://zapier.com/apps/code/help

@Troy Tessalone Thanks.  Yes, I read that article which is why I mentioned in the original post that date and time are required when using the (Date/Time) Before/After conditional statements.  How to do that when I don’t have a specific date?

@namvu808

You may want to consider using 2 Filters

First Filter to check if Sat OR Sun

Second Filter to check if Start/End “contains” any of these values using OR conditions:

00:00

...

09:00

 

17:00

...

23:00

 

NOTE: There are more advanced approaches to handling this by using a Code step to save Zap steps/tasks: https://zapier.com/apps/code/help

This would work definitely, but bookings can be made in 15 minute increments so it would really verbose.

Userlevel 7
Badge +14

@namvu808 

Consider changing the output format of the Formatter steps

You can specify a custom output using the ‘Custom’ option.
Check out this help article: https://zapier.com/help/create/format/modify-date-and-time-formats-in-zaps#customize-your-date-and-time-options
For example, since you don’t really care about the minutes (mm) or seconds (ss), then try an output like this:
ddd|hh (e.g. Mon|05)
This would allow you to do the 2 step Filter setup I mentioned.

Thanks. I got it working.  I entered all of the hours individually and used a Contains with the hour and a colon.  Also had to add a few more to take care of 17:15, 17:30 and 17:45.

Thanks!

Userlevel 7
Badge +14

@namvu808 

Another approach would be to use other Zaps on a Schedule: https://zapier.com/apps/schedule/integrations

Then you can use the Zapier Manager to Turn Zap ON/OFF.

 

@Troy Tessalone Thanks. I did see that in another thread.  It doesn’t work so well for what we are doing because if someone books something after hours we still need to know.  We’re not concerned about when they make the booking.  We are more concerned about when the booking takes place.

Reply