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

pascua

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pascua

Colombian holidays

  • 1.1.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
341
decreased by-16.22%
Maintainers
1
Weekly downloads
 
Created
Source

Pascua 🎆

install size gzip size Blazing Fast

npm version Build Status codecov Codacy Badge Greenkeeper badge

Extralight and no dependencies module to get Colombian holidays.


Getting Colombian holidays is a little bit tricky because there are three types of holidays:

  1. Fixed date: 6 holidays - Celebrated the same date they fall.
  2. Next monday: 7 holidays - Moved to the next moday after the date they fall.
  3. Relative to easter: 5 holidays - Celebrated relative to easter.

Installation

To install as a dependency of your project:

npm install pascua

To load it on the browser you can use unpkg, just add the following script. The pascua object will be available globally.

Use

Pascua include two functions: getHoliday y getAllHolidays.

Tell if a given date is holiday

The getHoliday function allows to check if a given date is a holiday. It takes as an optional argument a JavaScript date and returns the name of the holiday in case the date is a holiday, or an empty string ("")if it isn't.

const { getHoliday } = require('pascua')

const date = new Date('13-04-2017')
const holiday = getHoliday(date)
console.log(holiday)
// 'Jueves Santo'

If the date is ommited, by defaul the function is going to use the current date.

Get all holidays for a given year

The function getAllHolidays(year) allows to get all the holidays for a given year, returning an array with the holidays for the requested year:

const { getAllHolidays } = require('pascua')

const holidays2010 = getAllHolidays(2010)

The content of the holidays2010 variable will be the following array:

[
  { date: '2010-01-01', type: 1, name: 'Año Nuevo' },
  { date: '2010-05-01', type: 1, name: 'Día del Trabajo' },
  { date: '2010-07-20', type: 1, name: 'Grito de la Independencia' },
  { date: '2010-08-07', type: 1, name: 'Batalla de Boyacá' },
  { date: '2010-12-08', type: 1, name: 'Inmaculada Concepción' },
  { date: '2010-12-25', type: 1, name: 'Navidad' },
  { date: '2010-01-11', type: 2, name: 'Reyes Magos' },
  { date: '2010-03-22', type: 2, name: 'San José' },
  { date: '2010-07-05', type: 2, name: 'San Pedro y San Pablo' },
  { date: '2010-08-16', type: 2, name: 'Asunción de la Virgen' },
  { date: '2010-10-18', type: 2, name: 'Día de la Raza' },
  { date: '2010-11-01', type: 2, name: 'Todos los Santos' },
  { date: '2010-11-15', type: 2, name: 'Independencia de Cartagena' },
  { date: '2010-04-01', type: 3, name: 'Jueves Santo' },
  { date: '2010-04-02', type: 3, name: 'Viernes Santo' },
  { date: '2010-05-17', type: 3, name: 'Ascensión de Jesús' },
  { date: '2010-06-07', type: 3, name: 'Corpus Christi' },
  { date: '2010-06-14', type: 3, name: 'Sagrado Corazón de Jesús' },
],

Is the year is ommited, by default the function will return the holidays for the current year.

Contributing

Contributions, issues and feature requests are welcome!

Feel free to check the issues page.

Show your support

Give a ⭐️ if you like this project!

License

MIT.

Made in Bandera de Colombia.

Keywords

FAQs

Package last updated on 14 Jan 2020

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