diff --git a/include/library/Crunchbutton/Restaurant.php b/include/library/Crunchbutton/Restaurant.php index 9d4c90c30..a604cc011 100644 --- a/include/library/Crunchbutton/Restaurant.php +++ b/include/library/Crunchbutton/Restaurant.php @@ -424,7 +424,12 @@ class Crunchbutton_Restaurant extends Cana_Table $today = $DeLorean->now(); $day = strtolower($today->format('D')); + $hasHours = false; + foreach ($hours as $hour) { + + $hasHours = true; + if ($hour->day != $day) { continue; } @@ -443,6 +448,10 @@ class Crunchbutton_Restaurant extends Cana_Table } } + if( !$hasHours ){ + return true; + } + return false; } diff --git a/www/assets/js/restaurant.js b/www/assets/js/restaurant.js index 3258a69df..bf9dfe41e 100644 --- a/www/assets/js/restaurant.js +++ b/www/assets/js/restaurant.js @@ -119,14 +119,18 @@ var Restaurant = function(id) { */ self.open = function() { - // console.log(this.timezone); + // If it doesn't have hours it means it is always opened + if( !this._hours ){ + return true; + } + var isOpen = false; var today = Date.today().toString('ddd').toLowerCase(); if (this._hours == undefined || this._hours[today] == undefined) { return false; } todayHours = this._hours[today]; -console.log('today', today) + for (i in todayHours) { var openTime = Date.parse(todayHours[i][0]);