Pepuso Pepuso - 1 year ago 56
CSS Question

Setting up a JavaScript that writes whether the store is Open or Closed

I'm trying to setup a basic JavaScript, where if the day is Sunday or Saturday, it will write "Closed" in the HTML, or if it's later than 5:30pm, or it's earlier than 9:00am, it will also write out closed.

My main problem is that the if statement always seems to return true. I've tried multiple things to fix this and to no avail. Any help would be much appreciated.


Answer Source

This is not a complete answer, its more an advanced comment on code styling.

Your if statements look complicated, i still dont understand them. To improve your code make it more readable. That makes it easier for you and us to improve it. For example:


status="closed. Its too late";
status="closed. youre to early";
//code for other dates

//echo code