How can I display boxes during specific hours of the day

You can display boxes during specific hours of the day by using the JavaScript variable rules within your conditions.

Just place this function in custom JS parent:

api.checkTimeRangePST = function(sH, eH) {

    let now = new Date((new Date()).toLocaleString('en-US', { timeZone: 'America/Los_Angeles', hour12:true })).getHours()

    if (now >= sH && now <= eH) {

        return true;

    } else {

        return false;

    }

}

To target using this function:

  • Use this function as a variable in JavaScript Variable rule
  • To display during the time in range, type “true” in the value. If you don’t want it to display during this time, type “false.”
    • window.DIGIOH_API.checkTimeRangePST(startTime, endTime)
    • Please note that the startTime and the endTime are in 24-hour time format

Specific Hour Targeting

  • So on our example here display a box if time in this range (like 10am-12pm PST)
    • JavaScript Variable (Condition)
    • Equals
    • window.DIGIOH_API.checkTimeRangePST(10, 12)
    • true

If you need to change the Time Zone for the targeting:

To change the PST native time zone, change “Los_Angeles” in the function you placed in the custom JS parent to anything you want.

For example: New York/EST will be New_York

Change Time Zone