npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

brholidays

v1.1.0

Published

Biblioteca TypeScript para consultar feriados brasileiros por ano ou intervalo de datas, verificar se uma data é feriado e contar dias úteis.

Readme

brHolidays

Biblioteca TypeScript para consultar feriados brasileiros por ano ou intervalo de datas, verificar se uma data é feriado e contar dias úteis.

Instalação

npm install brholidays

Uso

Listar os feriados de um ano

listBrazillianHolidays retorna uma lista ordenada de feriados. A data vem no formato MM-DD.

import { listBrazillianHolidays } from "brholidays";

const feriados = listBrazillianHolidays(2025);
console.log(feriados.slice(0, 2));
// [
//   { date: "01-01", name: "Ano Novo" },
//   { date: "03-03", name: "Segunda-Feira de Carnaval" }
// ]

Também é possível usar a função padrão ou o alias brazillianHolidays. Se o ano não for informado, será usado o ano atual.

import brazillianHolidays from "brholidays";

const feriadosDesteAno = brazillianHolidays();

Listar feriados entre duas datas

listHolidaysBetweenDates recebe objetos Date. As datas inicial e final são incluídas no intervalo, e o resultado usa o formato YYYY-MM-DD.

import { listHolidaysBetweenDates } from "brholidays";

const feriados = listHolidaysBetweenDates(
  new Date(2025, 0, 1), // 1 de janeiro de 2025
  new Date(2025, 3, 30), // 30 de abril de 2025
);

console.log(feriados);
// Exemplo: { date: "2025-01-01", name: "Ano Novo" }

Verificar se uma data é feriado

isHoliday retorna true quando a data informada corresponde a um feriado listado.

import { isHoliday } from "brholidays";

isHoliday(new Date(2025, 0, 1)); // true
isHoliday(new Date(2025, 0, 2)); // false

Contar dias úteis em um intervalo

countBusinessDaysBetweenDates conta os dias de segunda a sexta-feira, excluindo os feriados listados. As datas inicial e final são consideradas na contagem.

import { countBusinessDaysBetweenDates } from "brholidays";

const diasUteis = countBusinessDaysBetweenDates(
  new Date(2025, 0, 1),
  new Date(2025, 0, 10),
);

console.log(diasUteis); // 7

Se a data inicial for posterior à data final, as funções de intervalo retornam uma lista vazia ou 0.

API

| Exportação | Descrição | | --------------------------------------------------- | -------------------------------------------------------------------------------------- | | listBrazillianHolidays(year) | Lista os feriados do ano; year é opcional na função padrão. | | brazillianHolidays(year) | Alias nomeado para a lista anual. | | listHolidaysBetweenDates(startDate, endDate) | Lista os feriados dentro do intervalo inclusivo. | | isHoliday(date) | Verifica se a data corresponde a um feriado listado. | | countBusinessDaysBetweenDates(startDate, endDate) | Conta dias úteis no intervalo inclusivo, excluindo fins de semana e feriados listados. |

Os feriados de data fixa e variável são retornados como objetos { date, name }. As funções usam o calendário local do ambiente JavaScript para interpretar os objetos Date.