dynamic_time_zone 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84f3075f7955fcf37f67f664b03c10993bb839163a4c078309940e98db9febc6
4
- data.tar.gz: c5860bb4c02c2926749209108287dca5b0a7fe60135fd3995b3f82f86fc061e4
3
+ metadata.gz: '086e49015eb839845d138706fa36e5f5389db097bf2612df00f7fe50ea1e9dd8'
4
+ data.tar.gz: 9ca0f7741e769f1b679157744e3713737a982de3438a5e693b48d40b3edfbbc6
5
5
  SHA512:
6
- metadata.gz: 7da51a26b381b6e64df3dae5afd70ea5c99b1531de98ccea72d116d6d54db39624e27295fbe383fc52794afec1fdba54309f8b0e319b812f7178b06699d0c5d1
7
- data.tar.gz: 4f675e03f7cd75d31173896e5433cad3b1de1b4b599b8561f87f9529d1d0e491e71ae1f8e5a46dde555e79415ef96ad9f1c683e818df7774a1ea14056b495f1f
6
+ metadata.gz: ecf0bdef79552069afce4a7bf669743679e3a64929ee858a10110b6d51d47b2c720f23cf767b86ac0352db5999322b584b7e78bb84b02d41060cfdc95683a46b
7
+ data.tar.gz: 59c876b2e3d98c82d0afb28a873fdbaa60dd83206ecb1575e257af45f86caa3b52b12d57e82bb95a4c3cfc8cc996de0df1937feb8b492113e2dfe016c927725b
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TimePatch
4
+ def compare_with_coercion(other)
5
+ if DynamicTimeZone.enabled && other.is_a?(ActiveSupport::TimeWithZone) && other.using_dynamic_time_zone?
6
+ self.utc <=> other.utc
7
+ else
8
+ super
9
+ end
10
+ end
11
+ alias_method :<=>, :compare_with_coercion
12
+ end
13
+
14
+ Time.prepend(TimePatch)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DynamicTimeZone
4
- VERSION = '0.3.1'
4
+ VERSION = '0.4.0'
5
5
  end
@@ -21,5 +21,6 @@ require 'dynamic_time_zone/validator'
21
21
  require 'dynamic_time_zone/identifier_builder'
22
22
  require 'dynamic_time_zone/time_zone_data_source'
23
23
  require 'dynamic_time_zone/time_with_zone_patch'
24
+ require 'dynamic_time_zone/time_patch'
24
25
  require 'dynamic_time_zone/offset_format_convertor'
25
26
  require 'dynamic_time_zone/time_parser'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamic_time_zone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Appfolio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-27 00:00:00.000000000 Z
11
+ date: 2022-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzinfo
@@ -55,6 +55,7 @@ files:
55
55
  - lib/dynamic_time_zone/offset_format_convertor.rb
56
56
  - lib/dynamic_time_zone/test_helper.rb
57
57
  - lib/dynamic_time_zone/time_parser.rb
58
+ - lib/dynamic_time_zone/time_patch.rb
58
59
  - lib/dynamic_time_zone/time_with_zone_patch.rb
59
60
  - lib/dynamic_time_zone/time_zone_data_source.rb
60
61
  - lib/dynamic_time_zone/validator.rb
@@ -77,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
78
  - !ruby/object:Gem::Version
78
79
  version: '0'
79
80
  requirements: []
80
- rubygems_version: 3.0.8
81
+ rubygems_version: 3.1.6
81
82
  signing_key:
82
83
  specification_version: 4
83
84
  summary: Dynamically set the offset from UTC from timezone identifier