Measure the amount of time during work hours between two dates
npm install --save get-time-between
Calculate the number of millseconds during working hours between two dates. The result of this can be formatted as you wish, with libraries such as pretty-ms
for example.
All methods take an optional 3rd argument containing the following options, shown here with their default values:
import { getTimeBetween } from "get-time-between";
const fridayFivePm = new Date("May 17 2019 17:00:00");
const mondayElevenAm = new Date("May 20 2017 11:00:00");
const timeBetween = getTimeBetween(fridayFivePm, mondayElevenAm, {
dailyEnd: [18, 0, 0], // [hour, minute, second] of the end of included days
dailyStart: [10, 0, 0], // [hour, minute, second] of the start of included days
excludedDays: [6, 0] // excluded days of the week (0-6 starting Sunday)
});
console.log(timeBetween);
// => 7200000
This project is a fork of https://github.com/tal/time-between by Tal Atlas.
Get help with issues by creating a Bug Report or discuss ideas by opening a Feature Request.
If you find my Open Source projects useful, please share them ❤️
- eslint-formatter-git-log
ESLint Formatter featuring Git Author, Date, and Hash - eslint-plugin-move-files
Move and rename files while keeping imports up to date - eslint-plugin-prefer-arrow-functions
Convert functions to arrow functions - ImageOptim-CLI
Automates ImageOptim, ImageAlpha, and JPEGmini for Mac to make batch optimisation of images part of your automated build process. - Jasmine-Matchers
Write Beautiful Specs with Custom Matchers - karma-benchmark
Run Benchmark.js over multiple Browsers, with CI compatible output - self-help
Interactive Q&A Guides for Web and the Command Line - syncpack
Manage multiple package.json files, such as in Lerna Monorepos and Yarn Workspaces
I'm Jamie Mason from Leeds in England, I began Web Design and Development in 1999 and have been Contracting and offering Consultancy as Fold Left Ltd since 2012. Who I've worked with includes Sky Sports, Sky Bet, Sky Poker, The Premier League, William Hill, Shell, Betfair, and Football Clubs including Leeds United, Spurs, West Ham, Arsenal, and more.