ae_bank_days 1.3.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ae_bank_days/bank_day_helper.rb +22 -8
- data/lib/ae_bank_days/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af37f7836eec42406fe3a2c1c86f3079f0b3ee95261020e770a8b3aa960ce524
|
4
|
+
data.tar.gz: 50fe48b765afdb9f3675934b157d809490b74985ce74e3a1fdd52428f28ccd9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a9b58a38b414c355268fcd982e232e216d4c8fe0ade9da1a6218e1c41e8cca852e3bcf6ae6b1d6cdae8013400006735eda668378237398ebc9016a7cfd7da79
|
7
|
+
data.tar.gz: c4fc232b7874a6d4c6be98c6860e189f7ab156821b61d3eb56b57371384b07acb96934c299fbd24268cebb46d8900e45242fabd43a76f80fe461fd5b11b81357
|
@@ -11,23 +11,37 @@ module AeBankDays
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def next_banking_day(date, number_of_days: 0)
|
14
|
-
banking_day = date
|
14
|
+
banking_day = date.to_date
|
15
|
+
banking_day += 1
|
15
16
|
number_of_days.times do
|
16
|
-
banking_day
|
17
|
+
banking_day = current_or_next_banking_day(banking_day)
|
17
18
|
banking_day += 1
|
18
19
|
end
|
19
|
-
|
20
|
-
banking_day
|
20
|
+
|
21
|
+
current_or_next_banking_day(banking_day)
|
21
22
|
end
|
22
23
|
|
23
24
|
def previous_banking_day(date, number_of_days: 0)
|
24
|
-
banking_day = date
|
25
|
+
banking_day = date.to_date
|
26
|
+
banking_day -= 1
|
25
27
|
number_of_days.times do
|
26
|
-
banking_day
|
28
|
+
banking_day = current_or_previous_banking_day(banking_day)
|
27
29
|
banking_day -= 1
|
28
30
|
end
|
29
|
-
|
30
|
-
banking_day
|
31
|
+
|
32
|
+
current_or_previous_banking_day(banking_day)
|
33
|
+
end
|
34
|
+
|
35
|
+
def current_or_previous_banking_day(day)
|
36
|
+
date = day.to_date
|
37
|
+
date -= 1 until bank_day?(date)
|
38
|
+
date
|
39
|
+
end
|
40
|
+
|
41
|
+
def current_or_next_banking_day(day)
|
42
|
+
date = day.to_date
|
43
|
+
date += 1 until bank_day?(date)
|
44
|
+
date
|
31
45
|
end
|
32
46
|
|
33
47
|
private
|
data/lib/ae_bank_days/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ae_bank_days
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AppFolio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: holidays
|