New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

sra

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sra

UK State Pension/Retirement Age calculation module

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

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/195060th birthday
6/4/1950 - 5/12/1953specified in table 1 and 2

Men

< 6/12/195365th birthday

Men and Women

6/12/1953 - 5/10/1954specified in table 3
6/10/1954 - 5/4/196066th birthday
6/4/1960 - 5/3/1961specified in table 4
6/3/1961 - 5/4/197767th birthday
6/4/1977 - 5/4/1978specified in table 5
> 5/4/197868th birthday

Author

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

License

This software is made available under the MIT license.

Keywords

retirement

FAQs

Package last updated on 10 Jan 2017

Related posts