0.1.1 • Published 7 years ago

sra v0.1.1

Weekly downloads
7
License
MIT
Repository
github
Last release
7 years ago

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

Men

Men and Women

Author

Steve Carter (ported from a previous implementation by Alttaf Hussain)

License

This software is made available under the MIT license.