diff --git a/app/helpers/admin/property_hires_helper.rb b/app/helpers/admin/property_hires_helper.rb index 7c44fc4..65bb585 100644 --- a/app/helpers/admin/property_hires_helper.rb +++ b/app/helpers/admin/property_hires_helper.rb @@ -58,7 +58,7 @@ module Admin::PropertyHiresHelper stime = [stime,recurring_end_date].max end can_hire_date = stime - (property.can_hire_before_months).month - msg += ("
" + I18n.t("property_hire.please_hire_after_date",{:date=>"{#{can_hire_date.utc.to_json.gsub('"','')}}"})) + msg += ("
" + I18n.t("property_hire.please_hire_after_date",{:date=>"{#{can_hire_date.new_offset(0).to_json.gsub('"','')}}"})) elsif available_flag == 3 ## need hire before default_msg = "This property must be reserved #{property.need_hire_before} #{property.need_hire_before_unit}s in advance." msg += I18n.t("property_hire.unavailable_hint3",{:month=>property.need_hire_before,:unit=>I18n.t("property_hire._#{property.need_hire_before_unit}",:default=>property.need_hire_before_unit),:default=>default_msg}) diff --git a/app/models/p_hire.rb b/app/models/p_hire.rb index f8640f5..9306e51 100644 --- a/app/models/p_hire.rb +++ b/app/models/p_hire.rb @@ -119,7 +119,7 @@ class PHire if date_only @recurring_events = @recurring_events.where(:date.ne=>nil) end - 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| datet = re.date interval = 1.send(re.recurring_interval) rescue 0 @@ -134,7 +134,7 @@ class PHire period_str = nil if re.recurring_interval == "week" period_str = 'week' - add_interval = (start_date_utc_mjd - @start_date.utc.mjd) + add_interval = (start_date_utc_mjd - @start_date.new_offset(0).mjd) days = 7.day if add_interval < 0 add_interval = -(-add_interval / days)