Skip to content

bladerunner2020/isdayoff

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Nov 14, 2020
Nov 14, 2020
Nov 14, 2020
Nov 14, 2020
Dec 20, 2020
Nov 14, 2020

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published