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.
Hello!
I'm using the LineItemService, and I'd like to convert the
startDateTimeinto a RubyTimeobject to do some comparison. I discovered that theto_timemethod returns the incorrect UTC offset during daylight saving time periods.This is because we're using the
utc_offsetmethod in TZInfo, which always returns the base offset without considering daylight saving. We could useutc_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.