Module: RujitsuDate

Defined in:
lib/rujitsu/date.rb

Instance Method Summary collapse

Instance Method Details

#start_of_last_monthObject



9
10
11
12
13
14
15
16
# File 'lib/rujitsu/date.rb', line 9

def start_of_last_month
  today = self.today
  if today.month == 1
    self.new(today.year - 1, 12)
  else
    self.new(today.year, today.month - 1)
  end
end

#start_of_next_monthObject



18
19
20
21
22
23
24
25
# File 'lib/rujitsu/date.rb', line 18

def start_of_next_month
  today = self.today
  if today.month < 12
    self.new(today.year, today.month + 1)
  else
    self.new(today.year + 1, 1)
  end
end

#start_of_this_monthObject



4
5
6
7
# File 'lib/rujitsu/date.rb', line 4

def start_of_this_month
  today = self.today
  self.new(today.year, today.month)
end