Calculate end dates, show in calendar
This commit is contained in:
parent
d980530cb9
commit
1341647c2a
4 changed files with 29 additions and 3 deletions
|
|
@ -24,3 +24,20 @@ def get_public_events()
|
|||
items.select { |i| (i[:kind]=='event') && i[:public] }
|
||||
end
|
||||
|
||||
def calculate_to_dates()
|
||||
items.select { |i| (i[:kind]=='event') && i[:duration] }.each do |e|
|
||||
if e[:startdate].instance_of?(Date)
|
||||
if e[:duration] =~ /(\d+)d/
|
||||
e[:enddate] = e[:startdate] + ($1.to_i - 1)
|
||||
end
|
||||
else
|
||||
if e[:duration] =~ /(\d+)h/
|
||||
e[:enddate] = e[:startdate] + 60*60*$1.to_i
|
||||
end
|
||||
if e[:duration] =~ /(\d+)m/
|
||||
e[:enddate] = e[:startdate] + 60*$1.to_i
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue