tax_jp 0.6.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23914854d9f1365751712d5b5132eeac54c266308a4146c7ab27368563f9adb2
4
- data.tar.gz: 100bba9475671a3bb4870042f1b3bcdfb636bb8b742e1bd5152554b2a44b8ca4
3
+ metadata.gz: 904f7717769647f9da08993e625ac91281a7f1ff1bbe22d0874ad904f8244a10
4
+ data.tar.gz: a3acce33105643a945c4daf4f60365fdf00476edb74a76e2221a8e5cb6cbb6ee
5
5
  SHA512:
6
- metadata.gz: 1205ad1fe331399e24d400eab1184c59da35e1e1b3b57296a0a5df4b6de0b471989e4b21b0e5b0504e06cda9ecd4560b32228043fafd81f081c71d6c846e6365
7
- data.tar.gz: 8a5630c96abbfcf37150276531b1681da9c741ef4806c8482bf7df6edc38a497f647af8fccbd0a18787bf3457897dd4f2811aa7046b077131511e7bb195b9596
6
+ metadata.gz: a5ceecdd7705804be8ca91a32ab64bca1bd850ba252ade724a9d73236092a991a7f0a2e14d0f942a7f3d64d70515a5d8c4071813a26f256e62ecbf09ce93aeda
7
+ data.tar.gz: 4bd87db6417730cd1ea0a6baae4bcaea6aa8c33fb420d2a2913fe45ca786b5406af6206595f597e1af422f669178eee6d212150c683f879543dc7422bfbf17ac
@@ -30,19 +30,19 @@
30
30
  <th class="text-center" colspan="4">厚生年金保険料(厚生年金基金加入員を除く)</th>
31
31
  </tr>
32
32
  <tr>
33
- <th class="text-center">等級</th>
34
- <th class="text-center">月額</th>
35
- <th class="text-center">日額</th>
36
- <th class="text-center">円以上</th>
37
- <th class="text-center">円未満</th>
38
- <th class="text-center">全額</th>
39
- <th class="text-center">折半額</th>
40
- <th class="text-center"><span class="text-nowrap">全額</span> <span class="text-nowrap">(介護保険2号)</span></th>
41
- <th class="text-center"><span class="text-nowrap">折半額</span> <span class="text-nowrap">(介護保険2号)</span></th>
42
- <th class="text-center">全額</th>
43
- <th class="text-center">折半額</th>
44
- <th class="text-center"><span class="text-nowrap">全額</span> <span class="text-nowrap">(坑内員/船員)</th>
45
- <th class="text-center"><span class="text-nowrap">折半額</span> <span class="text-nowrap">(坑内員/船員)</th>
33
+ <th class="text-center align-middle">等級</th>
34
+ <th class="text-center align-middle">月額</th>
35
+ <th class="text-center align-middle">日額</th>
36
+ <th class="text-center align-middle">円以上</th>
37
+ <th class="text-center align-middle">円未満</th>
38
+ <th class="text-center align-middle">全額</th>
39
+ <th class="text-center align-middle">折半額</th>
40
+ <th class="text-center align-middle">全額<br>(介護保険2号)</th>
41
+ <th class="text-center align-middle">折半額<br>(介護保険2号)</th>
42
+ <th class="text-center align-middle">全額</th>
43
+ <th class="text-center align-middle">折半額</th>
44
+ <th class="text-center align-middle">全額<br>(坑内員/船員)</th>
45
+ <th class="text-center align-middle">折半額<br>(坑内員/船員)</th>
46
46
  </tr>
47
47
  </thead>
48
48
  <tbody>
@@ -1,4 +1,6 @@
1
- 1868: "明治"
2
- 1912: "大正"
3
- 1926: "昭和"
4
- 1989: "平成"
1
+ 2019-05-01: 令和
2
+ 1989-01-08: 平成
3
+ 1926-12-25: 昭和
4
+ 1912-07-30: 大正
5
+ 1868-01-25: 明治
6
+ 1865-05-01: 慶応
data/lib/tax_jp/gengou.rb CHANGED
@@ -4,7 +4,7 @@ module TaxJp
4
4
  class Gengou
5
5
  @@_gengou = TaxJp::Utils.load_yaml('元号.yml')
6
6
 
7
- def self.to_seireki(gengou, year_jp)
7
+ def self.to_seireki(gengou, date_jp)
8
8
  target_gengou = nil
9
9
  @@_gengou.invert.keys.each do |start_gengou|
10
10
  if start_gengou == gengou.to_s
@@ -12,32 +12,40 @@ module TaxJp
12
12
  break
13
13
  end
14
14
  end
15
-
15
+
16
16
  return nil unless target_gengou
17
-
17
+
18
18
  start_year = @@_gengou.invert[target_gengou].to_i
19
19
  return (start_year + year_jp.to_i - 1).to_s
20
20
  end
21
21
 
22
- def self.to_wareki(year, only_year: false)
23
- return nil unless year.present?
22
+ def self.to_wareki(date, only_date: false, format: '%y年%m月%d日')
23
+ return nil unless date.present?
24
24
 
25
- target_year = nil
26
- @@_gengou.keys.sort.each do |start_year|
27
- break if start_year.to_i > year.to_i
28
- target_year = start_year
25
+ date = TaxJp::Utils.convert_to_date(date)
26
+
27
+ target_date = nil
28
+ @@_gengou.keys.each do |start_date|
29
+ target_date = TaxJp::Utils.convert_to_date(start_date)
30
+ break if date >= target_date
29
31
  end
30
32
 
31
- return nil unless target_year
33
+ return nil unless target_date
32
34
 
33
- gengou = @@_gengou[target_year]
34
- year_jp = year - target_year + 1
35
+ target_date = Date.strptime(target_date)
36
+ year, month, day = *(date.split('-').map{|x| x.to_i})
37
+ year_jp = year - target_date.year + 1
35
38
 
36
- if only_year
37
- year_jp.to_s
39
+ ret = Date.new(year_jp, month, day)
40
+ if only_date
41
+ ret = ret.strftime(format)
38
42
  else
39
- gengou + (year_jp == 1 ? '元' : year_jp.to_s)
43
+ gengou = @@_gengou[target_date]
44
+ year_jp = year_jp == 1 ? '元' : year_jp.to_s
45
+ ret = ret.strftime(format.gsub('%y', "#{gengou}#{year_jp}"))
40
46
  end
47
+
48
+ ret
41
49
  end
42
50
 
43
51
  end
data/lib/tax_jp/utils.rb CHANGED
@@ -42,7 +42,11 @@ module TaxJp
42
42
  if value.is_a?(Date)
43
43
  ret = value.strftime('%Y-%m-%d')
44
44
  elsif value.is_a?(String)
45
- ret = value
45
+ if value =~ /[0-9]{4}-[0-9]{2}-[0-9]{2}/
46
+ ret = value
47
+ else
48
+ raise ArgumentError.new(value)
49
+ end
46
50
  else
47
51
  raise TypeError.new(value.class)
48
52
  end
@@ -1,3 +1,3 @@
1
1
  module TaxJp
2
- VERSION = '0.6.2'
2
+ VERSION = '1.0.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tax_jp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ichylinux
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-03-14 00:00:00.000000000 Z
12
+ date: 2019-04-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bootstrap