Create a time zone that contains any offset from UTC. This gem assumes you use ActiveSupport
Add this to your Gemfile
gem 'dynamic_time_zone'Enable the dynamic time zone
DynamicTimeZone.enabled = trueSetup the time zone source
TZInfo::DataSource.set(DynamicTimeZone::TimeZoneDataSource.new)Use dynamic time zone
Time.zone = 'DynamicTimeZone/+360000' # 100 hours ahead of UTC
Time.zone = 'DynamicTimeZone/-360000' # 100 hours behind UTCTo validate time zone string to match this format
DynamicTimeZone::Validator.new.valid?('DynamicTimeZone/+360000') # valid
DynamicTimeZone::Validator.new.valid?('DynamicTimeZone/360000') # invalidTo run test:
bundle exec rspecTo run test in all appraisals:
bundle exec appraisal install && bundle exec appraisal rspecThe gem is available as open source under the terms of the MIT License.