Fix time zone problem.
This commit is contained in:
parent
c4883d495b
commit
2656b83ae8
|
@ -24,6 +24,6 @@ class EPaperTopic
|
||||||
end
|
end
|
||||||
|
|
||||||
def criteria_title
|
def criteria_title
|
||||||
PaperCriteria.where(:start_date.lte => self.period, :end_date.gte => self.period).first.title rescue ""
|
PaperCriteria.where(:start_date.lte => self.period.in_time_zone(Time.zone.utc_offset / 3600), :end_date.gte => self.period.in_time_zone(Time.zone.utc_offset / 3600)).first.title rescue ""
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -16,8 +16,8 @@ class PaperCriteria
|
||||||
|
|
||||||
|
|
||||||
def epaper_topics
|
def epaper_topics
|
||||||
tmp = EPaperTopic.where(:period.gte => self.start_date, :period.lte => self.end_date).can_display
|
tmp = EPaperTopic.where(:period.gte => self.start_date.in_time_zone(Time.zone.utc_offset / 3600), :period.lte => self.end_date.in_time_zone(Time.zone.utc_offset / 3600)).can_display
|
||||||
tmp = EPaperTopic.where(:period.gte => self.start_date, :period.lte => self.end_date).limit(1) if tmp.first.nil?
|
tmp = EPaperTopic.where(:period.gte => self.start_date.in_time_zone(Time.zone.utc_offset / 3600), :period.lte => self.end_date.in_time_zone(Time.zone.utc_offset / 3600)).limit(1) if tmp.first.nil?
|
||||||
tmp
|
tmp
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue