I'm having trouble getting DST offsets to matchup between ActiveSupport::TimeZone and ActiveSupport::TimeWithZone. Let's take Dublin for instance. Dublin is UTC +0 right now and UTC +1 in summer.
First we are generating a select dropdown for users, like so
ActiveSupport::TimeZone.all.collect{ |tz| ["(GMT#{ActiveSupport::TimeZone.seconds_to_utc_offset(tz.utc_offset)}) #{tz.name}", tz.name] }
But this incorrectly shows Dublin as +1. So I adjusted tz.utc_offset to tz.now.utc_offset and this correctly factors in DST, now showing Dublin as +0.
Great. Well, not quite.
After the user submits a time, we need to adjust that time using the user's selected time zone and then convert it back to UTC. However, when doing this with ActiveSupport::TimeWithZone#change, like so:
> time.change(zone: 'Dublin')
=> Tue, 30 Aug 2022 06:00:00.000000000 IST +01:00
This is still treating Dublin as +1, when it should be +0. So my question is, is there a way to factor DST into a TimeWithZone object as well, or is there another way I should be going about this?