This commit is contained in:
Daniel Camargo 2013-02-20 09:07:23 -03:00
parent 35523ca57d
commit 00a3a50157
2 changed files with 15 additions and 2 deletions

View File

@ -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;
}

View File

@ -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]);