fix promotion date format

This commit is contained in:
Yan
2017-09-18 17:36:17 +06:30
parent 3e0371a9fb
commit f4270ffd87

View File

@@ -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("(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)
promoList = Promotion.where("(Date_Format(promo_start_date, '%Y-%m-%d') <=? AND Date_Format(promo_end_date, '%Y-%m-%d') >=?) AND (promo_start_hour < ? AND promo_end_hour > ?)", current_day, current_day, current_time, current_time)
return promoList
end