Skip to content

Commit

Permalink
Fixed timezone lucene bug [#20 state:resolved]
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasronge committed Jan 16, 2009
1 parent 1cf7f3f commit 67acd5e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
7 changes: 4 additions & 3 deletions lib/lucene/field_info.rb
Expand Up @@ -54,9 +54,10 @@ def convert_to_ruby(value)
when Date.to_s
return value if value.kind_of? Date
return nil if value.nil?
date = org.apache.lucene.document.DateTools.stringToDate(value)
seconds_since_1970 = date.getTime / 1000
Date.new(*Time.at(seconds_since_1970).to_a[3 .. 5].reverse)
year = value[0..3].to_i
month = value[4..5].to_i
day = value[6..7].to_i
Date.new year,month,day
when DateTime.to_s
return value if value.kind_of? DateTime
return nil if value.nil?
Expand Down
1 change: 0 additions & 1 deletion test/lucene/field_info_spec.rb
Expand Up @@ -57,7 +57,6 @@
end

it "should convert Dates from lucene" do
pending "There is a bug with timezone and dates probably"
f = FieldInfo.new
f[:type] = Date
d = f.convert_to_ruby('20081215')
Expand Down
1 change: 0 additions & 1 deletion test/lucene/index_spec.rb
Expand Up @@ -419,7 +419,6 @@


it "can be used to convert and store Date field" do
pending "There is a bug with timezone and dates probably"
#given
@index.field_infos[:since][:store] = true
@index.field_infos[:since][:type] = Date
Expand Down

0 comments on commit 67acd5e

Please sign in to comment.