fix timezone

This commit is contained in:
Thein Lin Kyaw
2023-02-10 14:50:30 +06:30
parent 944f7a7259
commit 5d9281e196
18 changed files with 54 additions and 54 deletions

View File

@@ -31,7 +31,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(CONVERT_TZ(promo_start_date, '+00:00', Time.zone.formatted_offset), '%Y-%m-%d') <=? AND Date_Format(CONVERT_TZ(promo_start_date, '+00:00', Time.zone.formatted_offset), '%Y-%m-%d') >=?) AND (promo_start_hour < ? AND promo_end_hour > ?)", current_day, current_day, current_time, current_time)
promoList = Promotion.where("(Date_Format(CONVERT_TZ(promo_start_date, '+00:00', '<%= Time.zone.formatted_offset %>'), '%Y-%m-%d') <=? AND Date_Format(CONVERT_TZ(promo_start_date, '+00:00', '<%= Time.zone.formatted_offset %>'), '%Y-%m-%d') >=?) AND (promo_start_hour < ? AND promo_end_hour > ?)", current_day, current_day, current_time, current_time)
return promoList
end