searchlogic 2.3.11 → 2.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +1 -1
- data/lib/searchlogic/search.rb +11 -2
- data/searchlogic.gemspec +1 -1
- data/spec/search_spec.rb +2 -2
- metadata +1 -1
data/VERSION.yml
CHANGED
data/lib/searchlogic/search.rb
CHANGED
@@ -169,8 +169,17 @@ module Searchlogic
|
|
169
169
|
# with the other models.
|
170
170
|
column_for_type_cast = ::ActiveRecord::ConnectionAdapters::Column.new("", nil)
|
171
171
|
column_for_type_cast.instance_variable_set(:@type, type)
|
172
|
-
|
173
|
-
|
172
|
+
casted_value = column_for_type_cast.type_cast(value)
|
173
|
+
|
174
|
+
if Time.zone && casted_value.is_a?(Time)
|
175
|
+
if value.is_a?(String)
|
176
|
+
(casted_value + (Time.zone.utc_offset * -1)).in_time_zone
|
177
|
+
else
|
178
|
+
casted_value.in_time_zone
|
179
|
+
end
|
180
|
+
else
|
181
|
+
casted_value
|
182
|
+
end
|
174
183
|
end
|
175
184
|
end
|
176
185
|
|
data/searchlogic.gemspec
CHANGED
data/spec/search_spec.rb
CHANGED
@@ -261,13 +261,13 @@ describe "Search" do
|
|
261
261
|
it "should be a Time given 'Jan 1, 2009'" do
|
262
262
|
search = Order.search
|
263
263
|
search.created_at_after = "Jan 1, 2009"
|
264
|
-
search.created_at_after.should == Time.parse("Jan 1, 2009")
|
264
|
+
search.created_at_after.should == Time.zone.parse("Jan 1, 2009")
|
265
265
|
end
|
266
266
|
|
267
267
|
it "should be a Time given 'Jan 1, 2009 9:33AM'" do
|
268
268
|
search = Order.search
|
269
269
|
search.created_at_after = "Jan 1, 2009 9:33AM"
|
270
|
-
search.created_at_after.should == Time.parse("Jan 1, 2009 9:33AM")
|
270
|
+
search.created_at_after.should == Time.zone.parse("Jan 1, 2009 9:33AM")
|
271
271
|
end
|
272
272
|
|
273
273
|
it "should convert the time to the current zone" do
|