fiscal_year 0.3.0 → 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 +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +1 -1
- data/lib/fiscal_year/quarter.rb +4 -4
- data/lib/fiscal_year/version.rb +1 -1
- data/lib/fiscal_year/year_to_date.rb +9 -2
- 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: 1468592d50121d359747c36cc467fac062fd25b0b50344668b612074133527d3
|
4
|
+
data.tar.gz: b5428700e7f8b6b256e33b854623d1079d5aa3b93ce8a1873a14c6c660b3e1fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9609eac23bd8fd86a94a7f218d1ed613ac6bc8b0b3f231ebdc0a9f90fe21653170eb996def584b6bd9cf448f9e8f4f8e78c0092fe505c542737cb7c329422711
|
7
|
+
data.tar.gz: 0b4f5c6f0ad8939f62964b72d0fbf10f7aab52108e9de956888b9f038a997d9f6aa458c63ee4e83990fb767157b61ab0fb2a6401b77bcb821355660c11b1f591
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|

|
2
|
-
|
2
|
+
|
3
3
|
[](https://codeclimate.com/github/TsubasaKawajiri/fiscal_year/maintainability)
|
4
4
|
[](https://codeclimate.com/github/TsubasaKawajiri/fiscal_year/test_coverage)
|
5
5
|
|
data/lib/fiscal_year/quarter.rb
CHANGED
@@ -34,13 +34,13 @@ module FiscalYear
|
|
34
34
|
|
35
35
|
def range_by(date)
|
36
36
|
year = date.year
|
37
|
-
|
38
|
-
last_year = cross_year_in_quarter?(
|
37
|
+
this_quarter = months(date.month)
|
38
|
+
last_year = cross_year_in_quarter?(this_quarter) ? year + 1 : year
|
39
39
|
|
40
|
-
Date.parse("#{year}/#{
|
40
|
+
Date.parse("#{year}/#{this_quarter.first}/01")..Date.parse("#{last_year}/#{this_quarter.last}/01").end_of_month
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
43
|
+
def quarter_num(month)
|
44
44
|
rindex = FiscalYear.quarters.rindex(months(month))
|
45
45
|
|
46
46
|
rindex.nil? ? 0 : (rindex + 1)
|
data/lib/fiscal_year/version.rb
CHANGED
@@ -34,7 +34,7 @@ module FiscalYear
|
|
34
34
|
end
|
35
35
|
|
36
36
|
# TODO: fit to Abc size
|
37
|
-
def half_range_by(date) # rubocop:disable Metrics/AbcSize
|
37
|
+
def half_range_by(date) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
38
38
|
year = date.year
|
39
39
|
month = date.month
|
40
40
|
|
@@ -45,7 +45,14 @@ module FiscalYear
|
|
45
45
|
end
|
46
46
|
|
47
47
|
Date.parse(
|
48
|
-
"#{
|
48
|
+
"#{
|
49
|
+
if FiscalYear::Half.cross_year_in_half?(Half.second) &&
|
50
|
+
FiscalYear.cross_year_month?(month)
|
51
|
+
year - 1
|
52
|
+
else
|
53
|
+
year
|
54
|
+
end
|
55
|
+
}/#{Half.second.first}"
|
49
56
|
)..date.end_of_month.to_date
|
50
57
|
end
|
51
58
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fiscal_year
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tsubasa Kawajiri
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|