Project

age_jp

0.01
No commit activity in last 3 years
No release in over 3 years
A simpel age calculator for a law of Japan.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.0
>= 10.0
~> 3.0

Runtime

 Project Readme

AgeJp

Build Status

日本の法律に則った年齢計算です 年齢計算ニ関スル法律 - Wikipedia

年を取る日は誕生日の前日となる

Installation

Add this line to your application's Gemfile:

gem 'age_jp'

And then execute:

$ bundle

Or install it yourself as:

$ gem install age_jp

Usage

Timecop.freeze(Time.new(2014, 12, 31))

birthday = Date.new(2000, 1, 1)
birthday.age                                      # 14 (通常の年齢)
birthday.age_at(Date.today)                       # same as birthday.age
birthday.age_jp                                   # 15 (日本の法律準拠)
birthday.age_jp_at(Date.today)                    # same as birthday.age_jp
birthday.east_asian_age_reckoning                 # 15 (数え年)
birthday.east_asian_age_reckoning_at(Date.today)  # same as birthday.east_asian_age_reckoning
birthday.insurance_age                            # 14 (保険年齢)
birthday.insurance_age_at(Date.today)             # same as birthday.insurance_age
birthday.to_years_old(17)                         # 2017/01/01. 17歳の誕生日を返却
birthday.to_years_old_jp(17)                      # 2016/12/31. 17歳の年齢加算日(日本の法律準拠)を返却

Contributing

  1. Fork it ( https://github.com/[my-github-username]/age_jp/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request