🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

business-day-math

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

business-day-math

Add or subtract business days from a start date. Is timezone aware.

3.0.5
latest
npm
Version published
Weekly downloads
3
50%
Maintainers
1
Weekly downloads
 
Created
Source

Business Day Math

NPM Build Status

Business days are hard to calculate because you have to jump weekends. In addition, calculating across different timezones is difficult because the day of the week that the start date is on can vary.

This module allows you to accommodate all these needs.

Table of Contents generated with DocToc

Install

npm install business-day-math

Usage

var bizDays = require('business-day-math')
  , friPT = new Date('Fri May 9 2014 17:00:00 GMT-0700 (PST)')

 bizDays(1, friPT, 'America/Los_Angeles').toString() // Mon May 12 2014 17:00:00 GMT-0700 (PST)
 bizDays(-1, friPT, 'America/Los_Angeles').toString() // Thu May 8 2014 17:00:00 GMT-0700 (PST)

Options

  • days (Number) requried: The number of days to add or subtract from the start date.
  • startDate (Date) optional: The date to start from. If not provided, will default to today.
  • timezone (String) optional: The timezone files are named as one of the options from the RFC 3999 list of timezones (e.g. "Europe/London" is GMT). If not provided will default to the computer's timezone.

Tests

Tests are prova, based on tape. They can be run with npm test.

Developing

To publish, run npm run release -- patch

Keywords

business

FAQs

Package last updated on 28 Jan 2015

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