monkey-patch 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/monkey-patch/time.rb +18 -0
  2. metadata +1 -1
@@ -85,10 +85,28 @@ class Time
85
85
  Time.parse strftime "#{year - year % 10}-01-01 00:00:00 %z"
86
86
  end
87
87
 
88
+ def start_of_full_decade
89
+ decade = if year % 10 == 0
90
+ year - 9
91
+ else
92
+ year - year % 10 + 1
93
+ end
94
+ Time.parse strftime "#{decade}-01-01 00:00:00 %z"
95
+ end
96
+
88
97
  def start_of_century
89
98
  Time.parse strftime "#{year - year % 100}-01-01 00:00:00 %z"
90
99
  end
91
100
 
101
+ def start_of_full_century
102
+ century = if year % 100 == 0
103
+ year - 99
104
+ else
105
+ year - year % 100 + 1
106
+ end
107
+ Time.parse strftime "#{century}-01-01 00:00:00 %z"
108
+ end
109
+
92
110
  class << self
93
111
  %w(commercial england gregorian italy jd jisx0301 julian ld mjd ordinal today yesterday)
94
112
  .each do |method|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monkey-patch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: