crons = []
closest_monday = DateTime.parse('monday').in_time_zone('America/Caracas')
user_time = closest_monday.change(hour: 17)
hours_range = 18
in_utc = user_time.getutc
end_in_utc = in_utc + hours_range.hours
is_next_day = in_utc.to_date != end_in_utc.to_date
hour = in_utc.hour
end_hour = in_utc.end_of_day.hour
wday = in_utc.wday
crons << "*/15 #{hour}-#{end_hour} * * #{wday}"
if is_next_day
hour = end_in_utc.hour
begin_hour = end_in_utc.beginning_of_day.hour
wday = end_in_utc.wday
crons << "*/15 #{begin_hour}-#{hour} * * #{wday}"
end
p crons