Fix display recurring events bug.

This commit is contained in:
BoHung Chiu 2021-10-05 22:26:22 +08:00
parent c4ef2557a3
commit b4aa1d125b
1 changed files with 4 additions and 1 deletions

View File

@ -136,7 +136,10 @@ class PHire
if unavailable && (unavailable_start_date <= @start_date) && (unavailable_end_date >= @end_date) && !((@start_date.strftime("%w").to_i .. @end_date.strftime("%w").to_i).to_a & unavailable_weekdays).empty?
startt = DateTime.parse(@start_date.strftime("%Y-%m-%d " + unavailable_start_time + Time.zone.to_s))
endt = DateTime.parse(@end_date.strftime("%Y-%m-%d " + unavailable_end_time + Time.zone.to_s))
next if !((startt..endt) & (@start_date..@end_date)).blank?
if !((startt..endt) & (@start_date..@end_date)).blank?
break if (@start_date + interval) > new_end_date
next
end
end
if @start_date >= start_date
@recurring << re.as_json({:startt=>@start_date,:endt=>@end_date,:datet=>datet})