How can I display boxes during specific hours of the day

You can display boxes during specific hours of the day in Digioh 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 successfully target using this function:

  • Use this function as a variable in JavaScript Variable rule
  • If you want to display if the time in range just type true in the value but if you don’t want it to display during that time type false
    • window.DIGIOH_API.checkTimeRangePST(startTime, endTime)
    • Please note that the startTime and the endTime in 24 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:

If you’d want to change the PST native time zone, you’ll 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