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

date-holidays

Package Overview
Dependencies
Maintainers
1
Versions
158
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

date-holidays

worldwide holidays

  • 3.19.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
98K
decreased by-40.11%
Maintainers
1
Weekly downloads
 
Created

What is date-holidays?

The date-holidays npm package is a comprehensive library for handling public holidays for various countries and regions. It allows you to query holidays, check if a specific date is a holiday, and get holiday names and details.

What are date-holidays's main functionalities?

Initialize Holidays for a Specific Country

This feature allows you to initialize the holidays for a specific country. In this example, the holidays for the United States are initialized.

const Holidays = require('date-holidays');
const hd = new Holidays('US');

Get Holidays for a Specific Year

This feature allows you to get a list of holidays for a specific year. The code sample retrieves the holidays for the year 2023.

const holidays = hd.getHolidays(2023);
console.log(holidays);

Check if a Specific Date is a Holiday

This feature allows you to check if a specific date is a holiday. The code sample checks if December 25, 2023, is a holiday.

const isHoliday = hd.isHoliday(new Date('2023-12-25'));
console.log(isHoliday);

Get Holiday Details for a Specific Date

This feature allows you to get detailed information about a holiday on a specific date. The code sample retrieves details for the holiday on December 25, 2023.

const holidayDetails = hd.getHoliday(new Date('2023-12-25'));
console.log(holidayDetails);

Set and Get Locale for Holiday Names

This feature allows you to set the locale for holiday names and retrieve holidays in that locale. The code sample sets the locale to Spanish and retrieves the holidays for 2023 in Spanish.

hd.setLocale('es');
const holidaysInSpanish = hd.getHolidays(2023);
console.log(holidaysInSpanish);

Other packages similar to date-holidays

Keywords

FAQs

Package last updated on 12 May 2023

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