1.0.1 • Published 3 years ago

isdayoff v1.0.1

Weekly downloads
4
License
MIT
Repository
-
Last release
3 years ago

IsDayOff

IsDayOff is a Javascript API wrapper for isdayoff.ru that returns info on working/non-working date for specified date or period.

Installation

npm install isdayoff --save

Usage

const api = require('isdayoff')();
// Alternatively API object can be cerated:
// const { IsDayOffAPI } = require('isdayoff');
// const api = new IsDayOffAPI();

// returns is today wokring/non-working day
api.today()
  .then((res) => console.log(`Today is ${res ? 'non-' : ''}working day.`))
  .catch((err) => console.log(err.message));

// returns arrray of wokring/non-working day for September 10
api.date({ month: 8, date: 10 }) 
  .then((res) => console.log(`10.09 is ${res ? 'non-' : ''}working day.`))
  .catch((err) => console.log(err.message));

// returns arrray of wokring/non-working day for September
api.month({ month: 8 })
  .then((res) => console.log(JSON.stringify(res)))
  .catch((err) => console.log(err.message));

// returns arrray of wokring/non-working day for 2021
api.year({ year: 2021 }) 
  .then((res) => console.log(JSON.stringify(res)))
  .catch((err) => console.log(err.message));

// returns arrray of wokring/non-working day for periodd
api.period({
  start: new Date('2020-09-10'),
  end: new Date('2020-09-15')
})
  .then((res) => console.log(JSON.stringify(res)))
  .catch((err) => console.log(err.message));

License

MIT

1.0.1

3 years ago

1.0.0

3 years ago