Skip to content Skip to sidebar Skip to footer

How To Determine The Image That Is Displayed During Business Hours/days?

So I already asked this question before and I received the following as an answer which truly helps! However lets say the business opens at 9:00 AM and closes at 5:00 PM PST time (

Solution 1:

Change the bottom few lines to this, it is a little muddled at present.

if (d.getDay() !== 0 && d.getDay() !== 6 && (d >= open && d < closed)) {
    setOpenStatus(true);
} else {
    setOpenStatus(false);
}

So you understand the condition, it says: If it is not Sunday (d.getDay() !== 0) or Saturday (d.getDay() !== 6) and the current time is after or at the opening time (d >= open) and before the closing time (d < closed), then set the open status, otherwise (else), set closed status.


Post a Comment for "How To Determine The Image That Is Displayed During Business Hours/days?"