0.0.1 • Published 8 years ago

workinghours v0.0.1

Weekly downloads
2
License
BSD-2-Clause
Repository
github
Last release
8 years ago

Working hours

Utility to calculate working hours and get due dates.

Installation

npm install [--save] workinghours

Configuration

var wh = require('workinghours');

wh.setStartTime('9:00');
wh.setCloseTime('17:30');
var newYearsDay = new Date(2016, 0, 1);
wh.addHoliday(newYearsDay)

Usage

var date1 = new Date(2015, 11, 31, 12, 0);
var date2 = new Date(2016, 0, 4, 10, 0);
wh.workingHours(new Date(date1, date2));  // Returns 6.5 working hours
wh.workingDays(date1, date2)  // Returns 1 working day

Tests

npm test

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.