sra - UK State Pension/Retirement Age library
A straightforward(!) UK State Retirement Age calculation library that we thought might be useful for someone out there.
Installation
$ npm install sra
Usage
Simply invoke the exported function passing it
- date of birth - as a JavaScript Date object (if missing or not a Date current date will be used; if before 1900-04-06 will be reset to 1900-04-06)
- gender - enumerated string 'male or 'female' (if missing or illegal value supplied will be set to 'female')
and get back an object with properties:
- date - Date object corresponding to the retirement date
- age - Array containing age at retirement [y,m,d]
Example:
var sra = require('sra');
var dob = new Date('1959-02-20');
var gender = 'male';
var result = sra(dob, gender);
var d = result.date
// 2025-02-20
var a = result.age
var retirementAge = a[0]" years "+a[1]+" months "+a[2]+" days"
// 66 years 0 months 0 days
Specification
This module is based on HM Government State Pension Age timetable published by the Department for Work and Pensions update 15 May 2014 under the Open Government Licence v3.0.
The timetable is complicated because the government is both trying to unify retirement ages for men and women and also extend retirement age for both. The timetable is broken into specific tables applicable to different birth dates as follows:
Women
< 6/4/1950 | 60th birthday |
6/4/1950 - 5/12/1953 | specified in table 1 and 2 |
Men
< 6/12/1953 | 65th birthday |
Men and Women
6/12/1953 - 5/10/1954 | specified in table 3 |
6/10/1954 - 5/4/1960 | 66th birthday |
6/4/1960 - 5/3/1961 | specified in table 4 |
6/3/1961 - 5/4/1977 | 67th birthday |
6/4/1977 - 5/4/1978 | specified in table 5 |
> 5/4/1978 | 68th birthday |
Author
Steve Carter (ported from a previous implementation by Alttaf Hussain)
License
This software is made available under the MIT license.