@dwp/get-state-pension-date

2.0.2 • Public • Published

get-state-pension-date

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 @dwp/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('@dwp/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('@dwp/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('@dwp/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.

Readme

Keywords

none

Package Sidebar

Install

npm i @dwp/get-state-pension-date

Weekly Downloads

25

Version

2.0.2

License

ISC

Unpacked Size

26.8 kB

Total Files

9

Last publish

Collaborators

  • dwp-bot
  • jgdwp
  • lhokktyn