JSPM

workingday-uk

1.1.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q35365F
  • License MIT

Determine if a date is a working day in the UK, according to UK government website

Package Exports

  • workingday-uk

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (workingday-uk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

workingday-uk

Promise-based node package to determine if a date is a working day in the UK, based on being a weekday, and not a bank holiday, according to the UK government website.

Usage

fn([string isoDate]|[Date date], [boolean offline])
  • Takes an optional Date object or a string in the format YYYY-mm-DD. Default: today
  • Takes an optional boolean whether to work offline. Default: true (using a local copy of the GOV.UK bank holiday API response)

Examples

Use with no params for today

const isWorkingDay = require('workingday-uk')

isWorkingDay()
.then(iwd => {
    console.log('Today is a working day? ' + iwd)
})

Use with a date

const isWorkingDay = require('workingday-uk')

const dateToCheck = new Date(2000, 0, 1) //1st Jan 2000

isWorkingDay(dateToCheck)
.then(iwd => {
    console.log(iwd) //False
})

Use with a date string of YYYY-MM-DD

const isWorkingDay = require('workingday-uk')

const dateToCheck = '2019-12-24'

isWorkingDay(dateToCheck)
.then(iwd => {
    console.log(iwd) //True - Tuesday, and not a bank holiday
})

Check online for today

const isWorkingDay = require('workingday-uk')

isWorkingDay(false)
.then(iwd => {
    console.log('Today is a working day? ' + iwd)
})

Check online for Christmas Day

const isWorkingDay = require('workingday-uk')

const dateToCheck = '2019-12-25'

isWorkingDay(dateToCheck, false)
.then(iwd => {
    console.log(iwd) //False
})