Class: DynamicTimeZone::IdentifierBuilder
- Inherits:
-
Object
- Object
- DynamicTimeZone::IdentifierBuilder
- Defined in:
- lib/dynamic_time_zone/identifier_builder.rb
Instance Method Summary collapse
Instance Method Details
#from_target_datetime(year:, month:, day:, hour:) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/dynamic_time_zone/identifier_builder.rb', line 5 def from_target_datetime(year:, month:, day:, hour:) now = DateTime.now.new_offset target = DateTime.new(year, month, day, hour, now.minute, now.second) offset = target.to_i - now.to_i 'DynamicTimeZone/' + (offset.negative? ? '' : '+') + offset.to_s end |