Class: Pyk::Date
- Inherits:
-
Object
- Object
- Pyk::Date
- Defined in:
- lib/pyk/date.rb
Class Method Summary collapse
-
.end_of_financial_year(d) ⇒ Object
Pyk::Date.end_of_financial_year(d).
-
.end_of_month(month, year) ⇒ Object
Pyk::Date.end_of_month(month, year).
-
.next_month(month) ⇒ Object
Pyk::Date.next_month(month).
-
.start_of_financial_year(d) ⇒ Object
Pyk::Date.start_of_financial_year(d).
-
.year_next_month(month, year) ⇒ Object
Pyk::Date.year_next_month(month, year).
Class Method Details
.end_of_financial_year(d) ⇒ Object
Pyk::Date.end_of_financial_year(d)
9 10 11 |
# File 'lib/pyk/date.rb', line 9 def self.end_of_financial_year(d) Date.new(d.to_i, 3, 31).to_time + 86340 end |
.end_of_month(month, year) ⇒ Object
Pyk::Date.end_of_month(month, year)
14 15 16 |
# File 'lib/pyk/date.rb', line 14 def self.end_of_month(month, year) Date.new(year, month, -1).to_time + 86340 end |
.next_month(month) ⇒ Object
Pyk::Date.next_month(month)
19 20 21 |
# File 'lib/pyk/date.rb', line 19 def self.next_month(month) (month == 12) ? 1 : month + 1 end |
.start_of_financial_year(d) ⇒ Object
Pyk::Date.start_of_financial_year(d)
4 5 6 |
# File 'lib/pyk/date.rb', line 4 def self.start_of_financial_year(d) Date.new((d.to_i - 1), 4, 1).to_time end |
.year_next_month(month, year) ⇒ Object
Pyk::Date.year_next_month(month, year)
24 25 26 |
# File 'lib/pyk/date.rb', line 24 def self.year_next_month(month, year) (month == 12) ? year + 1 : year end |