Skip to content

Commit

Permalink
change DATE_TIME_FORMAT in filter to include timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
seanxiesx committed Aug 6, 2013
1 parent 4e576a9 commit db16095
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/quickeebooks/shared/service/filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Service
class Filter

DATE_FORMAT = '%Y-%m-%d'
DATE_TIME_FORMAT = '%Y-%m-%dT%H:%M:%S'
DATE_TIME_FORMAT = '%Y-%m-%dT%H:%M:%S%Z'

attr_reader :type
attr_accessor :field, :value
Expand Down
2 changes: 1 addition & 1 deletion spec/quickeebooks/online/services/filter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
it "can generate a datetime filter" do
time = Time.mktime(2012, 1, 2, 8, 31, 44)
filter = Quickeebooks::Online::Service::Filter.new(:datetime, :field => "CreateTime", :after => time)
filter.to_s.should == "CreateTime :AFTER: 2012-01-02T08:31:44"
filter.to_s.should == "CreateTime :AFTER: 2012-01-02T08:31:44UTC"
end

it "can generate a number filter with equals" do
Expand Down
12 changes: 6 additions & 6 deletions spec/quickeebooks/shared/filter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,39 @@
it 'parses after with time' do
filter.new(:datetime,
:field => 'Foo',
:after => DateTime.parse('2020-12-31T12:00:00')).to_s.should == "Foo :AFTER: 2020-12-31T12:00:00"
:after => DateTime.parse('2020-12-31T12:00:00')).to_s.should == "Foo :AFTER: 2020-12-31T12:00:00+00:00"
end

it 'parses before with time' do
filter.new(:datetime,
:field => 'Foo',
:before => DateTime.parse('2020-12-31T12:00:00')).to_s.should == "Foo :BEFORE: 2020-12-31T12:00:00"
:before => DateTime.parse('2020-12-31T12:00:00')).to_s.should == "Foo :BEFORE: 2020-12-31T12:00:00+00:00"
end
end

context 'Time' do
it 'parses after' do
filter.new(:datetime,
:field => 'Foo',
:after => Time.parse('2020-12-31')).to_s.should == "Foo :AFTER: 2020-12-31T00:00:00"
:after => Time.parse('2020-12-31')).to_s.should == "Foo :AFTER: 2020-12-31T00:00:00UTC"
end

it 'parses before' do
filter.new(:datetime,
:field => 'Foo',
:before => Time.parse('2020-12-31')).to_s.should == "Foo :BEFORE: 2020-12-31T00:00:00"
:before => Time.parse('2020-12-31')).to_s.should == "Foo :BEFORE: 2020-12-31T00:00:00UTC"
end

it 'parses after with time' do
filter.new(:datetime,
:field => 'Foo',
:after => Time.parse('2020-12-31 12:00:00')).to_s.should == "Foo :AFTER: 2020-12-31T12:00:00"
:after => Time.parse('2020-12-31 12:00:00')).to_s.should == "Foo :AFTER: 2020-12-31T12:00:00UTC"
end

it 'parses before with time' do
filter.new(:datetime,
:field => 'Foo',
:before => Time.parse('2020-12-31 12:00:00')).to_s.should == "Foo :BEFORE: 2020-12-31T12:00:00"
:before => Time.parse('2020-12-31 12:00:00')).to_s.should == "Foo :BEFORE: 2020-12-31T12:00:00UTC"
end
end

Expand Down

0 comments on commit db16095

Please sign in to comment.