Opening and Closing times

Hi all,

I’m trying to find a way to add store open and closing times to my app which blocks orders once the store is closed. Is this possible and does anyone know how to do it?

I’m new to this no code stuff so any help would be appreciated.

Thanks

Aaron

Hi Aaron,

One approach to this is listing the store opening and closing times in an app variable and then comparing them to the current date time using the NOW() function. If you expect that different dates have different closing times, one possibility would be to construct a variable with this kind of schema:

And populate it like so:

In this case, this formula would access today’s openingHour:

"OPENING TODAY AT: " + FIND_BY_KEY(appVars.openingHours, "weekdayName", NOW("dddd")).openingHour

Note that NOW("dddd") will return dates in the format “Monday”, “Tuesday”, etc. so make sure to check for capital letters in your app variable.
In the button that processes orders, you could use an IF flow function and check if the current time is greater than the opening hour and less than the closing hour:

NUMBER(NOW("hh")) >= FIND_BY_KEY(appVars.openingHours, "weekdayName", NOW("dddd")).openingHour && NUMBER(NOW("hh")) < FIND_BY_KEY(appVars.openingHours, "weekdayName", NOW("dddd")).closingHour