From 3dc7fea339ce9c2213725350fc3373a61bde4c59 Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 5 Sep 2017 14:12:53 +0630 Subject: [PATCH] date format fix for promotion --- app/models/promotion.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/promotion.rb b/app/models/promotion.rb index 624818f1..30bbf4a5 100644 --- a/app/models/promotion.rb +++ b/app/models/promotion.rb @@ -23,7 +23,7 @@ class Promotion < ApplicationRecord end def self.is_between_promo_datetime(current_day,current_time) #database is not local time - promoList = Promotion.where("(TO_CHAR(promo_start_date, 'YYYY-MM-DD') <=? AND TO_CHAR(promo_end_date, 'YYYY-MM-DD') >=?) AND (promo_start_hour < ? AND promo_end_hour > ?)", current_day, current_day, current_time, current_time) + promoList = Promotion.where("(Date_Format(promo_start_date, 'YYYY-MM-DD') <=? AND Date_Format(promo_end_date, 'YYYY-MM-DD') >=?) AND (promo_start_hour < ? AND promo_end_hour > ?)", current_day, current_day, current_time, current_time) return promoList end