Skip to content

A library to provide UK State Pension date, given date of birth and gender

License

Notifications You must be signed in to change notification settings

gunjam/get-state-pension-date

 
 

Repository files navigation

get-state-pension-date

Build Status Code Coverage XO code style Install size

This package provides functions that allows the calculation of the date on which a UK citizen becomes eligible for their State Pension.

Installation

npm install get-state-pension-date

Usage

getStatePensionDate()

Takes a date of birth string and a gender and returns a Date object representing when State Pension age would be reached.

For example:

const {getStatePensionDate} = require('get-state-pension-date');

// Date: 2058-03-25T00:00:00.000Z
const spaDate = getStatePensionDate('1990-03-25', 'male');

getStatePensionDateAsString()

Takes the same parameters as getStatePensionDate() but returns the State Pension age date as a string.

For example:

const {getStatePensionDateAsString} = require('get-state-pension-date');

// string: 2058-03-25
const spaString = getStatePensionDateAsString('1990-03-25', 'female');

isOverStatePensionAge()

Takes a date of birth and returns a boolean, returning true if the State Pension age date is today or in the past, false if it’s in the future.

For example:

const {isOverStatePensionAge} = require('get-state-pension-date');

// boolean: true
const overSpa = isOverStatePensionAge('1953-03-25');

// boolean: false
const workingAge = isOverStatePensionAge('1990-03-25');

All functions will throw if the date of birth is not a YYYY-MM-DD formatted string or if the gender is not a string of male or female.

Caveat

The dates produced by this package are based on legislation in place at the point of publishing (November 2018). Dates that fall beyond the current legislation (i.e. after 5/4/1977) are calculated on a best endeavours basis only.

Further information about State Pension age timetables.

About

A library to provide UK State Pension date, given date of birth and gender

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%