ruby-ext-js 0.3.1 → 0.3.2

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/README.markdown CHANGED
@@ -65,6 +65,10 @@ Examples:
65
65
 
66
66
  Version number conventions: Patch-level bumps for bug fixes, minor-level bumps for changes that break backwards-compatibility, major-level bumps for major new features.
67
67
 
68
+ ## 0.3.2
69
+
70
+ * Respect local time offset for `ExtJs::Mongo` date range filters.
71
+
68
72
  ## 0.3.1
69
73
 
70
74
  * Use `Time.utc` instead of `Date` for `ExtJs::Mongo` date range filters.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
data/lib/ruby-ext-js.rb CHANGED
@@ -150,13 +150,14 @@ module ExtJs
150
150
 
151
151
  case hash["data"]["type"]
152
152
  when "date"
153
+ offset = Time.now.utc_offset
153
154
  values.map!{ |date| date = Date.parse( date ); Time.utc( date.year, date.month, date.day ) }
154
155
  if comparison == "=="
155
156
  start_time = values[0]
156
157
  end_time = Time.utc( start_time.year, start_time.month, start_time.day, 23, 59, 59 )
157
- values = { comparison_for( "gt" ) => start_time, comparison_for( "lt" ) => end_time }
158
+ values = { comparison_for( "gt" ) => start_time + offset, comparison_for( "lt" ) => end_time + offset }
158
159
  else
159
- values = { comparison => values[0] }
160
+ values = { comparison => values[0] + offset }
160
161
  end
161
162
  else
162
163
  if values.size == 1
data/ruby-ext-js.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruby-ext-js}
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tyson Tate"]
@@ -88,9 +88,10 @@ describe "ExtJs" do
88
88
  end
89
89
 
90
90
  it "handles date range params" do
91
+ offset = Time.now.utc_offset
91
92
  date = Date.parse "11/26/2010"
92
- start_time = Time.utc( date.year, date.month, date.day )
93
- end_time = Time.utc( date.year, date.month, date.day, 23, 59, 59 )
93
+ start_time = Time.utc( date.year, date.month, date.day ) + offset
94
+ end_time = Time.utc( date.year, date.month, date.day, 23, 59, 59 ) + offset
94
95
 
95
96
  params = { "filter" => {
96
97
  "0" => {
@@ -133,8 +134,9 @@ describe "ExtJs" do
133
134
  end
134
135
 
135
136
  it "handles invalid comparison operators by falling back to $in" do
137
+ offset = Time.now.utc_offset
136
138
  date = Date.parse "11/26/2010"
137
- start_time = Time.utc( date.year, date.month, date.day )
139
+ start_time = Time.utc( date.year, date.month, date.day ) + offset
138
140
 
139
141
  params = { "filter" => {
140
142
  "0" => {
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-ext-js
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tyson Tate