-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
Environment:ruby-2.3.3 macOS High Sierra
-
1
Using the aggregation pipeline with a match query with a `start_date` like this one
match_date = { '$match': { 'created_at': { '$gte': start_date } }
It would seem that the offset is ignored when using ActiveSupport::TimeWithZone (astwz) objects that have an offset.
Assume the server is in Paris/UTC+2 and
start_date_astwz = 1.hour.ago #=> Thu, 03 May 2018 09:52:46 CEST +02:00
Then when using the match date, the time returnes would actually be
Thu, 03 May 2018 09:52:46 CEST +00:00 (so 2 hours in the future)
When converting to Time (for instance using `.utc`) it works as expected, so I guess a fix would be to systematically call .utc
start_date_time = 1.hour.ago.utc #=> "2018-05-03T07:53:33.060Z" # and works fine
- depends on
-
RUBY-1529 Support ActiveSupport::TimeWithZone serialization to BSON on bson-ruby level
- Closed
-
RUBY-1619 Release BSON 4.4.0
- Closed
- is depended on by
-
MONGOID-4658 Fix & integration test querying by TimeWithZone via driver
- Closed
- related to
-
SERVER-6310 Timezone support in date operators at query time
- Closed