This commit is contained in:
BoHung Chiu 2021-10-05 10:15:04 +08:00
parent eaa1009dda
commit 97d7d0e90f
1 changed files with 7 additions and 0 deletions

View File

@ -110,6 +110,13 @@ class PHire
recurring_end_date = re.recurring_end_date
new_end_date = [recurring_end_date,end_date].min
@end_date = re.end_time
if @start_date < start_date
if re.recurring_interval == "week"
@start_date += (start_date - @start_date).to_i / 7) * interval
else
@start_date += ((start_date.year * 12 + start_date.month) - (@start_date.year * 12 + @start_date.month) - 1) * interval
end
end
while @start_date <= new_end_date do
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))