Skip to content

Instantly share code, notes, and snippets.

@rknLA
Created July 18, 2012 23:53
Show Gist options
  • Save rknLA/3139778 to your computer and use it in GitHub Desktop.
Save rknLA/3139778 to your computer and use it in GitHub Desktop.
is this an ActiveSupport::TimeZone bug?
[68] pry(#<Api::MeasurementsController>)> params[:since]
=> "2012-07-18 23:17:44 UTC"
[69] pry(#<Api::MeasurementsController>)> @result.first.updated_at
=> Wed, 18 Jul 2012 23:17:44 UTC +00:00
[70] pry(#<Api::MeasurementsController>)> cutoff = ActiveSupport::TimeZone['UTC'].parse(params[:since])
=> Wed, 18 Jul 2012 23:17:44 UTC +00:00
[72] pry(#<Api::MeasurementsController>)> cutoff.to_i
=> 1342653464
[73] pry(#<Api::MeasurementsController>)> @result.first.updated_at.to_i
=> 1342653464
[74] pry(#<Api::MeasurementsController>)> cutoff == @result.first.updated_at
=> false
[75] pry(#<Api::MeasurementsController>)> cutoff.eql? @result.first.updated_at
=> false
[76] pry(#<Api::MeasurementsController>)> cutoff > @result.first.updated_at
=> false
[77] pry(#<Api::MeasurementsController>)> cutoff < @result.first.updated_at
=> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment