Wed, 2016-05-18 08:29
I have a table with opening hours:
Monday to Thursday Friday Saturday and Sunday
7:00am - 22:00pm 7:00am to 19:00pm 9:30am to 17:30pm
have Closed DIV and an open DIV
Want hide or show the above table depending on the time.
I have done the code below but I need some pointers how to deal with the part hours 9:30 and 17:30 on the weekend
Thank you
*****************************
<script language="javascript" type="text/javascript"> $(document).ready(function () { var d = new Date(); var dayOfWeek = d.getDay(); var hour = d.getHours(); var minute = d.getMinutes() // open hours Monday - Friday 9am - 5:pm = open if ((dayOfWeek >= 1 && dayOfWeek <= 4 && hour <= 7 || hour >= 22 ) || (dayOfWeek === 5 && hour <= 7 || hour >= 19) || ((dayOfWeek === 6 || dayOfweek === 0 ) && hour <= 9 || hour >= 17 )) { $('.open').hide(); } // closed any other time than above * working from 0am -9am but none other else { $('.closed').hide(); } }); </script>
Wed, 2016-05-18 19:40
#1
Hi OskaSomething like:||
Hi Oska
Something like:
|| ((dayOfWeek === 6 || dayOfweek === 0 ) && (hour <9 || (hour === 9 && minute < 30)) || (hour > 17 || ( hour === 17 && minute > 30)) ))