extended_date 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/extended_date.rb +3 -3
- metadata +2 -2
data/lib/extended_date.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
require 'date'
|
2
2
|
|
3
3
|
class Date
|
4
|
-
def self.
|
4
|
+
def self.first_day_of_month_for(dat, day)
|
5
5
|
parsed_date = Date.parse(dat.to_s)
|
6
|
-
parsed_date.
|
6
|
+
parsed_date.first_day_of_month(day)
|
7
7
|
end
|
8
8
|
|
9
9
|
def beginning_of_month
|
10
10
|
Date.parse(self.strftime("%Y-%m-1"))
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def first_day_of_month(day)
|
14
14
|
req_wday = case
|
15
15
|
when ["sunday", "0"].include?(day.to_s.downcase) then 0
|
16
16
|
when ["monday", "1"].include?(day.to_s.downcase) then 1
|