business 3.1.0 → 3.2.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: 9f04f06e8df7909e07f17eb5ef5066935eea815e7139260bc1542d785f999d3b
4
- data.tar.gz: 68df07bcc51b18a1406badfaeeeb78c05412d726a506be589a7bdbd139105877
3
+ metadata.gz: 40ea955d78824ad8e83d5265c4b291fb3b769a332d2783d42e933a94ad40923f
4
+ data.tar.gz: 1ae889aeea3e8649b8a53b616e0b2b0e3be400fb9879cbb3ffff4e2c4d7900bb
5
5
  SHA512:
6
- metadata.gz: 95d2bf588e43841cc35e48e416d610466a18738a777c812d7c7dff1d121d715d270247e5a2895753c3bc1742400f58e924a626dbe152e0d0ed5a9803241070d4
7
- data.tar.gz: c7e583aba5f2870a3ddb0ec5e91ef6e64e03dfb5cf5de1a6d246bea345ef9cccb3304dc6d21edb3f5508ae62646b1f7dd8330578a1457b96eaf3bd46fa2a6faa
6
+ metadata.gz: 8b3b625612e5339fb10ef38ff80f0cb955596b9294d49eda5f96c60d5d647c7e90de292109f23d8df9d8aae2353be81bdd129f9f21f3927a58dc59ddb90b8f9d
7
+ data.tar.gz: ad28326f5d4ca2a556ceb4f132def2440815c187e77e3d13652008ac7975b31034db73e14ccf4e731e07b792b1254cfeb41a3eac8b6edd24b15c99ccfe77bd3f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## Upcoming
2
2
 
3
+ ## 3.2.0 - Nov 3, 2026
4
+
5
+ - Advance `ActiveSupport::TimeWithZone`s whole days across DST boundaries #339
6
+
3
7
  ## 3.1.0 - Sept 28, 2026
4
8
 
5
9
  - Fix `business_days_between` not counting extra working dates in full weeks #34 - thanks @anatoliliotych!
@@ -209,7 +209,13 @@ module Business
209
209
  end
210
210
 
211
211
  def day_interval_for(date)
212
- date.is_a?(Date) ? 1 : 3600 * 24
212
+ if date.is_a?(Date)
213
+ 1
214
+ elsif defined?(ActiveSupport::TimeWithZone) && date.is_a?(ActiveSupport::TimeWithZone)
215
+ 1.day
216
+ else
217
+ 3600 * 24
218
+ end
213
219
  end
214
220
 
215
221
  # Internal method for assigning working days from a calendar config.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Business
4
- VERSION = "3.1.0"
4
+ VERSION = "3.2.0"
5
5
  end
@@ -1049,4 +1049,18 @@ RSpec.describe Business::Calendar do
1049
1049
 
1050
1050
  it_behaves_like "common"
1051
1051
  end
1052
+
1053
+ context "(using TimeWithZone objects)" do
1054
+ before do
1055
+ stub_const("ActiveSupport::TimeWithZone", Class.new(Time))
1056
+ Integer.define_method(:day) { self * 60 * 60 * 24 }
1057
+ end
1058
+
1059
+ after { Integer.remove_method(:day) }
1060
+
1061
+ let(:date_class) { ActiveSupport::TimeWithZone }
1062
+ let(:day_interval) { 1.day }
1063
+
1064
+ it_behaves_like "common"
1065
+ end
1052
1066
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: business
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GoCcardless