Show Mobile Action Bar During Certain Times Only

Does anybody know any Corvid Wix code that can be used to show the mobile action bar during certain times only? I would like to show a ‘call’ button during office hours only.

Thank you.

Hi :raised_hand_with_fingers_splayed:

You can do this by getting the current time, and use a while loop to check whether the time allow the action bar to be visible or not, here’s a quick code if you want the action bar to be visible from 8 AM to 4 PM:

let today = new Date();

let hours = today.toLocaleTimeString(en-US, {hour: '2-digit', hour12: false})

while (hours >= 8 && hours <= 16) {
    if ($w('#actionBar1').collapsed) {
        $w('#actionBar1').expand();
    }
}

while (hours < 8 && hours > 16) {
    if (!$w('#actionBar1').collapsed) {
        $w('#actionBar1').collapse();
    }
}

Use this code inside the page’s onReady() function in the Site code section.

Hope this helps~!
Ahmad

Thanks! Is there a way of showing one action during certain hours and then another in the other set of hours? or is this too much?