We set a schudule in our js function (i.e. Monday to Friday from 9:00 to 21:00) and comparing it with the user’s date we show/hide the phone number.
How to built it:
First of all we generate a new Date()
–> var d = new Date();
Then we get the user’s day
–> d.getDay() (if all your clients are in the same time zone you can use this)
–> d.getUTCDay() (if you have clients in diferent time zones use this function and compare all dates with UTC time)
If the client is out of the Business-days we hide the phone number.
If your client is in a Business-day then we get the user’s hour
If the client is out of the Business-hours we hide the phone number.
By doing this we can show our phone number only when the client is in our Business Hours.
I hope this helps.