Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

holidays-calendar-brazil

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

holidays-calendar-brazil

Library for retrieving the Brazilian Holidays' calendar.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
75
increased by97.37%
Maintainers
1
Weekly downloads
 
Created
Source

HolidaysCalendar-Brazil

This is a library for retrieving the Brazilian Holidays' Calendar.

You can use it as a Node.js module or in browser.

Instalation

If you use NPM, then you can install it with npm install holidays-calendar-brazil. Othewise, you can download the latest release and use it in your browser or in other Javascript-based projects.

Usage

Node.js

var calendar = require("holidays-calendar-brazil");
console.log('The total number of holidays in 2020 is '+calendar.Year(2020).total);

Browser

<script src="../node_modules/holidays-calendar/dist/HolidaysCalendar.js"></script>
<script src="HolidaysCalendar-brazil.js" charset="utf-8"></script>
<script>
console.log('The total number of holidays in 2020 is '+HolidaysCalendar.Year(2020).total);
</script>

API Reference

Year(year)

Retrieves information about holidays in year.

year: integer, required. Year reference.

return: Mixed. Object with structure: {total: integer, months: array of integer} when there are holidays within that year; False when there are no holidays in the given year.

Example
 var calendar = require("holidays-calendar-brazil");
 var data = calendar.Year(2020);
 \\data equals { months: [ 1, 2, 4, 5, 6, 9, 10, 11, 12 ], total: 11 }

Month(year, month)

Retrieves information about holidays in a specific month.

year: integer, required. Year reference.

month: integer, required. Month reference (January=1).

return: Mixed. Object with structure: {total: integer, days: array of integer} when there are holidays within that month; False when there are no holidays in the given month.

Example
 var calendar = require("holidays-calendar-brazil");
 var data = calendar.Month(2020, 2);
 \\data equals { days: [ 24, 25 ], total: 2 }

Day(year, month, day)

Retrieves information about a holiday in a specific date.

year: integer, required. Year reference.

month: integer, required. Month reference (January=1).

day: integer, required. Day reference.

return: Mixed. String representing the holiday name if the given date corresponds to a holiday according to the calendar in use; False when the date isn't a holiday.

Example
 var calendar = require("holidays-calendar-brazil");
 var data = calendar.Day(2020, 2, 25);
 \\data equals 'Carnaval'

FAQs

Package last updated on 24 Jan 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc