Fix bug for ruby 2.7.

This commit is contained in:
BoHung Chiu 2022-10-25 10:45:59 +08:00
parent 329e9631b9
commit 014f114574
1 changed files with 2 additions and 2 deletions

View File

@ -219,7 +219,7 @@ class Event
def self.recurring_event(start_date, end_date, preserve_hide=false)
@recurring_events = self.where(:recurring => true).any_of({:recurring_end_date=>nil}, {:recurring_end_date.gte=>start_date.utc})
@recurring = []
start_date_utc_mjd = start_date.to_datetime.utc.mjd
start_date_utc_mjd = start_date.to_datetime.new_offset(0).mjd
@recurring_events.each do |re|
has_recurring_end_date = re.recurring_end_date.present?
data = re.as_json({}, true)
@ -259,7 +259,7 @@ class Event
elsif is_year
add_interval = (start_date.year - @start_date.year)
else
add_interval = (start_date_utc_mjd - @start_date.utc.mjd)
add_interval = (start_date_utc_mjd - @start_date.new_offset(0).mjd)
if add_interval < 0
add_interval = -(-add_interval / days)
else