Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class MeetingDates
def initialize
@crb_dates = []
@jam_dates = []
calc_meeting_dates
end
def calc_meeting_dates
start_date = Date.today.beginning_of_year
(0..12).inject([]){|s, num| dates_for_month(start_date + num.months)}
end
def dates_for_month(relative_date)
s = relative_date.beginning_of_month
e = relative_date.end_of_month
crb_date = (s..e).select{|d| d.wday == 1}[2] + 18.5.hours
@crb_dates << crb_date
@jam_dates << crb_date + 9.days
end
def next_crb_meeting
@crb_dates.find{|d| d > Time.now}
end
def next_jam_meeting
@jam_dates.find{|d| d > Time.now}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment