Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Check if a day is a workday or holiday.
Available too: brazilian portuguese.
Before anything, you need to have node and npm installed.
$ npm install calendario
Currently there are only national calendars (except for Brazil and U.S.A). In next release will be added regional support.
Available for:
.use('BR')
.use('US')
You can set the calendar using use()
var calendario = require('calendario');
calendario.use('BR');
Setting the calendar for a specific state
var calendario = require('calendario');
calendario.use('US-NY');
You can create your owns calendars, passing a array of objects like these:
var calendario = require('calendario');
calendario.use('MozillaCalendar', [
{date: new Date('2020-11-25'), workday: true, summary: "Mozilla Summit"},
{date: new Date('2021-1-20'), workday: true, summary: "Mozilla another event"}
]);
calendario.use('GoogleCalendar', function(set) {
set([
{date: new Date('2017-6-3'), workday: true, summary: "Google IO"},
{date: new Date('2018-10-5'), workday: true, summary: "Google another event"},
]);
});
You can create your own calendar, passing a ics
file
var calendario = require('calendario');
calendario.use('BR', {file: 'pt-br.ics', parser: 'ics'});
Verify if the day in question is a working day, based on defined calendar sources:
var calendario = require('calendario');
calendario.use('BR');
calendario.isWorkday(new Date('2015-05-01')); // false
calendario.isWorkday(new Date('2015-05-02')); // true
Get all events about specified day:
var calendario = require('calendario');
calendario.use('US');
calendario.aboutDay(new Date('2015-12-25'))
/*
[ { date: Fri Dec 25 2015 00:00:00 GMT-0200 (BRST),
summary: 'Christmas Day',
workday: false } ]
*/
Get all events from a specified begin to a specified end:
var calendario = require('calendario');
calendario.use('US');
var range = calendario.range()
.begin(new Date('2015-12-20'))
.end(new Date('2016-01-05'))
.toArray();
/*
[ { date: Thu Dec 24 2015 00:00:00 GMT-0200 (BRST),
summary: 'Christmas Eve (from 2pm)',
workday: false },
{ date: Fri Dec 25 2015 00:00:00 GMT-0200 (BRST),
summary: 'Christmas Day',
workday: false },
{ date: Thu Dec 31 2015 00:00:00 GMT-0200 (BRST),
summary: 'New Year\'s Eve (from 2pm)',
workday: false },
{ date: Fri Jan 01 2016 00:00:00 GMT-0200 (BRST),
summary: 'New Year\'s Day',
workday: false } ]
*/
Return all defined calendars as source:
var calendario = require('calendario');
calendario.use('US');
calendario.use('BR');
calendario.sourceList(); // ['US', 'BR']
Return the events from all sources:
var calendario = require('calendario');
calendario.use('MozillaCalendar', [
{date: new Date('2020-11-25'), workday: true, summary: "Mozilla Summit"},
{date: new Date('2021-1-20'), workday: true, summary: "Mozilla another event"}
]);
calendario.eventList();
/*
[ { workday: true,
summary: 'Mozilla Summit',
date: Tue Nov 24 2020 22:00:00 GMT-0200 (BRST) },
{ workday: true,
summary: 'Mozilla another event',
date: Wed Jan 20 2021 00:00:00 GMT-0200 (BRST) } ]
*/
Clear and remove all previously defined sources:
var calendario = require('calendario');
calendario.use('BR'); // Sources: ['BR']
calendario.clear(); // Sources: []
By default the calendario don't consider weekends as workdays. However you can change this using:
var calendario = require('calendario');
calendario.ignoreWeekends();
pt-br.brazilian#holiday@group.v.calendar.google.com
en.usa#holiday@group.v.calendar.google.com
See Changelog for more details.
Don't be shy, send a Pull Request! Here is how:
git checkout -b my-new-feature
git commit -m 'Add some feature'
git push origin my-new-feature
License: MIT ® Raphael Amorim
FAQs
Check if a day is a workday or holiday
The npm package calendario receives a total of 8 weekly downloads. As such, calendario popularity was classified as not popular.
We found that calendario demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.