xdevplatform/twitter-ruby-ads-sdk

time_zone on to_time helper

Closed this issue · 1 comments

Issue Type: Bug

Description:

to_time(time, granularity = nil) make a new Time for the desired granularity but does not take time_zone into account.
The impact should be extremely low.

to_time('2016-09-22T19:00:00'.to_datetime.in_time_zone('UTC'), granularity: :hour)

Expected Result:

"2016-09-22T19:00:00Z"

Actual Result:

"2016-09-22T19:00:00-03:00"

Note that local time_zone is -03:00

Steps to Reproduce:

  • Call to_time method with a date on a different local time_zone and granularity :hour or :day.

Relates To:

See here for a suggested fix: #148