Class: CoolDates

Inherits:
Object
  • Object
show all
Defined in:
lib/cool_dates.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.get_middle_of_next_month_date(year, month) ⇒ Object



11
12
13
# File 'lib/cool_dates.rb', line 11

def self.get_middle_of_next_month_date year, month
  (Time.parse("1-#{month}-#{year} 0:1 UTC") + 45 * 24 * 60 * 60).to_date
end

.get_middle_of_past_month_date(year, month) ⇒ Object



15
16
17
# File 'lib/cool_dates.rb', line 15

def self.get_middle_of_past_month_date year, month
  (Time.parse("1-#{month}-#{year} 0:1 UTC") - 15 * 24 * 60 * 60).to_date
end

Instance Method Details

#get_middle_of_next_month_date(year, month) ⇒ Object



3
4
5
# File 'lib/cool_dates.rb', line 3

def get_middle_of_next_month_date year, month
  (Time.parse("1-#{month}-#{year} 0:1 UTC") + 45 * 24 * 60 * 60).to_date
end

#get_middle_of_past_month_date(year, month) ⇒ Object



7
8
9
# File 'lib/cool_dates.rb', line 7

def get_middle_of_past_month_date year, month
  (Time.parse("1-#{month}-#{year} 0:1 UTC") - 15 * 24 * 60 * 60).to_date
end