2.2.0 • Published 2 years ago

@alheimsins/virkedager v2.2.0

Weekly downloads
17
License
MIT
Repository
github
Last release
2 years ago

js-standard-style

virkedager

Simple tool for calculating working days.

Usage

Get next virkedag

Input a date object and an optional number of working days (defaults to 2). Get a date string in return.

The module starts counting working days from the day after input date. It will skip saturdays, sundays and all Norwegian public holidays.

const virkedager = require('@alheimsins/virkedager')
const date = new Date('2020-04-07')
console.log(virkedager(date, 3)) // => 2020-04-15

isVirkedag

Input a date object and get true/false if given date is a workingday.

const { isVirkedag } = require('@alheimsins/virkedager')
const dateHoliday = new Date('2020-09-20')
const dateWorkingday = new Date('2020-09-21')
console.log(isVirkedag(dateHoliday)) // => false
console.log(isVirkedag(dateWorkingday)) // => true

erInneklemtDag

Input a date object and get true/false if given date is between two holidays.

const { erInneklemtDag } = require('@alheimsins/virkedager')
const dateInneklemt = new Date('2021-05-14')
const dateNotInneklemt = new Date('2021-05-18')
console.log(erInneklemtDag(dateInneklemt)) // => true
console.log(erInneklemtDag(dateNotInneklemt)) // => false

erInneklemtUke

Input a date object and get true/false if given week got 3 or less working days.

const { erInneklemtUke } = require('@alheimsins/virkedager')
const dateInneklemt = new Date('2022-04-14')
const dateNotInneklemt = new Date('2022-04-04')
console.log(erInneklemtUke(dateInneklemt)) // => true
console.log(erInneklemtUke(dateNotInneklemt)) // => false

License

MIT

About

Created with ❤ for Alheimsins

2.2.0

2 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago