partial-date 1.1.6 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.textile CHANGED
@@ -1,5 +1,9 @@
1
1
  h3. 1.1.6 / 2012-05-30
2
2
 
3
+ * BugFix: Another logical error in to_s - fixed (formatters next).
4
+
5
+ h3. 1.1.6 / 2012-05-30
6
+
3
7
  * Bugfix: Checked that sign is switched off when a postive year is set after a negative year.
4
8
  * Bugfix: Fixed to_s again (before formatters are implemented).
5
9
 
@@ -133,9 +133,7 @@ module PartialDate
133
133
  #
134
134
  # Returns nothing
135
135
  def year=(value)
136
- if value.nil?
137
- raise YearError, "Year cannot be nil"
138
- end
136
+ value = 0 if value.nil?
139
137
 
140
138
  if value.is_a?(String)
141
139
  if value =~ /\A\-?\d{1,7}\z/
@@ -228,7 +226,7 @@ module PartialDate
228
226
  result = ""
229
227
  if value != 0
230
228
  result = year.to_s.rjust(4, '0') if year != 0
231
- result = result + "-" if result.length > 3
229
+ result = result + "-" if result.length > 3 && month > 0
232
230
  result = result + month.to_s.rjust(2, '0') if month > 0
233
231
  result = result + "-" + day.to_s.rjust(2, '0') if day > 0
234
232
  return result
@@ -1,4 +1,4 @@
1
1
  module PartialDate
2
2
  # partial-date version
3
- VERSION = "1.1.6"
3
+ VERSION = "1.1.7"
4
4
  end
data/spec/date_spec.rb CHANGED
@@ -83,10 +83,6 @@ describe PartialDate::Date do
83
83
 
84
84
 
85
85
  describe "Year" do
86
- it "should raise an error if year is set to nil" do
87
- expect {date.year = nil}.to raise_error(PartialDate::YearError)
88
- end
89
-
90
86
  it "should raise an error if year is set to an invalid string" do
91
87
  expect {date.year = "ABCD" }.to raise_error(PartialDate::YearError, "Year must be a valid string or integer from -1048576 to 1048576")
92
88
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: partial-date
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6
4
+ version: 1.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: