To determine whether a day is a business day for a company, you need to consider its business hours and the days of the week on which it operates.
For example, a company may be open from 8:00 a.m. to 8:00 p.m. and closed on Saturdays and Sundays. In this case, Saturdays and Sundays would be non-business days for this company.
| Name | Value |
|---|---|
| check_day | {company.now|format:l} |
| check_time | {company.now|format:G} |
This action allows you to store the name of the day of the week and the current time in hours in variables. For more information on formatting variables, see the article Date and time formatting tools.
Draw an arrow from the Settings block to the Result block.
Add a Condition block and draw an arrow from the Result block to it.
Add an Information block with a message stating that the company is closed today, and connect it to the Condition block with an arrow.
Set the following parameters for the arrow:
{check_day} * Saturday, Parameter 2 — {check_day} * Sunday.Add another Condition block and draw an arrow with the Default type from the previous Condition block to it.
Connect an arrow of type Default from the new Condition block to the Information block.
Add an Information block with a message stating that the company is open today, and connect an arrow from the new Condition block to it.
Set the following parameters for the arrow:
{check_time} >= 8, Parameter 2 — {check_time} < 20.
This script allows you to determine whether the current day is a business day for the company based on its schedule.
For example, if the company is open from 8:00 AM to 8:00 PM and is closed on Saturdays and Sundays, this script will check the current day and time. If the current day is Saturday or Sunday, or if the current time is outside the 8:00 a.m.–8:00 p.m. range, the script will indicate that the company is closed.
The script can be adapted to any company’s schedule by modifying the conditions in the blocks.