🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@alheimsins/virkedager

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alheimsins/virkedager

Simple module for calculating working days

latest
Source
npmnpm
Version
2.2.0
Version published
Weekly downloads
868
190.3%
Maintainers
2
Weekly downloads
 
Created
Source

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

Keywords

virkedager

FAQs

Package last updated on 03 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts