Skip to content

AdManagerApi::AdManagerDateTime#to_time returns incorrect UTC offset #205

Description

@adherr

Hello!

I'm using the LineItemService, and I'd like to convert the startDateTime into a Ruby Time object to do some comparison. I discovered that the to_time method returns the incorrect UTC offset during daylight saving time periods.

This is because we're using the utc_offset method in TZInfo, which always returns the base offset without considering daylight saving. We could use utc_total_offset, but the way it is used, we always call it with the current time rather than the time that is being converted.

I think the correct solution is to pass the timezone object to the Time constructor rather than a utc_offset.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions