Gorgias logo
Gorgias logo

All articles

Check whether the current time is in business hoursUpdated 10 months ago

This suggestion isn't an official feature of our Chat widget, so our support for it is limited - we recommend that it be implemented by someone with a technical background.


You can use the following method to determine whether the Chat business hours (as defined in the helpdesk) are displayed correctly - this variable is only trustworthy after Chat initialization:

1<script>
2var initGorgiasChatPromise = (window.GorgiasChat) ? window.GorgiasChat.init() : new Promise(function (resolve) { window.addEventListener('gorgias-widget-loaded', function () { resolve();})});
3
4initGorgiasChatPromise.then(function() {
5 GorgiasChat.isBusinessHours() // Will return true or false.
6})
7</script>
Was this article helpful?
Yes
No