Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
holiday-greetfinder
Advanced tools
A utility that lets you determine if a given date is a holiday and also show a greeting. Works until 2028, no API access required.
Ever wanted to show a greeting for a major holiday in your app without manually writing it out? This library has you covered!
Example usage:
getHolidayGreeting('2024-10-31', 'Asia/Tokyo') => Happy Diwali 🪔
getHolidayGreeting('2024-06-16', 'America/New_York') => Eid Mubarak 🌙
This is a simple library for checking cultural and religious holidays worldwide. This package supports both checking specific holidays and getting holiday greetings based on dates.
There are no external dependencies and no reliance on an API.
Note: This will work until 2028, I will likely update the data way before that :) I tried to write logic to compute these dates but that got very complex. Sometimes hardcoding is best!
npm install holiday-greetfinder
You can determine the following holidays (and show these greetings for them!) Merry Christmas Happy Christmas Eve Eid Mubarak Happy Hanukkah Chag Pesach Sameach Shana Tova Happy Diwali Happy Easter Happy Earth Day Happy Valentine's Day Happy Halloween Happy New Year Happy Thanksgiving Happy Father's Day Happy Mother's Day Happy US Independence Day Happy St. Patrick's Day ¡Feliz Cinco de Mayo! Happy Africa Day Happy Pride Happy Holi G'mar Chatima Tova Happy Canadian Thanksgiving Happy Lunar New Year Happy Carnival Happy Junkanoo Happy Nowruz Happy Vesak ¡Feliz Día de los Muertos! Prost Oktoberfest!
Each holiday has its own boolean function that returns true if the given date matches the holiday:
import {
isChristmas,
isDiwali,
isEidMubarak,
isHanukkah
// ... other holiday functions
} from 'holiday-checker';
// Check if a date is Christmas
isChristmas('2024-12-25') // true
isChristmas('2024-12-24') // false
// Check if a date is Diwali
isDiwali('2024-10-31') // true
isDiwali('2024-10-30') // false
// Check with timezone
isEidMubarak('2024-04-10', 'Asia/Dubai') // true
isHanukkah('2024-12-25', 'America/New_York') // true
isChristmas(date: string, timezone?: string): boolean
isChristmasEve(date: string, timezone?: string): boolean
isEidMubarak(date: string, timezone?: string): boolean
isHanukkah(date: string, timezone?: string): boolean
isPassover(date: string, timezone?: string): boolean
isRoshHashanah(date: string, timezone?: string): boolean
isDiwali(date: string, timezone?: string): boolean
isEaster(date: string, timezone?: string): boolean
isEarthDay(date: string, timezone?: string): boolean
isValentinesDay(date: string, timezone?: string): boolean
isHalloween(date: string, timezone?: string): boolean
isNewYear(date: string, timezone?: string): boolean
isThanksgiving(date: string, timezone?: string): boolean
isFathersDay(date: string, timezone?: string): boolean
isMothersDay(date: string, timezone?: string): boolean
isIndependenceDay(date: string, timezone?: string): boolean
isStPatricksDay(date: string, timezone?: string): boolean
isCincoDeMayo(date: string, timezone?: string): boolean
isAfricaDay(date: string, timezone?: string): boolean
isHoli(date: string, timezone?: string): boolean
isYomKippur(date: string, timezone?: string): boolean
isCanadianThanksgiving(date: string, timezone?: string): boolean
isLunarNewYear(date: string, timezone?: string): boolean
isCarnival(date: string, timezone?: string): boolean
isJunkanoo(date: string, timezone?: string): boolean
isNowruz(date: string, timezone?: string): boolean
isVesak(date: string, timezone?: string): boolean
isDiaDeLosMuertos(date: string, timezone?: string): boolean
isOktoberfest(date: string, timezone?: string): boolean
The getHolidayGreeting
function returns an array of holiday greetings for a given date:
import { getHolidayGreeting } from 'holiday-checker';
// Get holidays for a specific date
const holidays = getHolidayGreeting('2024-12-25');
console.log(holidays);
// [
// { greeting: "Merry Christmas", emoji: "🎄" },
// { greeting: "Happy Hanukkah", emoji: "🕎" } // When holidays overlap
// ]
// Get holidays for a date with no celebrations
const noHolidays = getHolidayGreeting('2024-03-15');
console.log(noHolidays); // []
All functions support an optional timezone parameter using IANA timezone identifiers. You should provide these for the best result:
// Check Diwali in different timezones
isDiwali('2024-10-31', 'Asia/Kolkata') // true
isDiwali('2024-10-31', 'America/New_York') // true
// Get holiday greetings for different timezones
getHolidayGreeting('2024-10-31', 'Asia/Tokyo') => Happy Diwali 🪔
getHolidayGreeting('2024-06-16', 'America/New_York') => Eid Mubarak 🌙
// Examples of supported timezones:
// - 'America/New_York'
// - 'America/Los_Angeles'
// - 'Europe/London'
// - 'Asia/Tokyo'
// - 'Asia/Kolkata'
// - 'Australia/Sydney'
// etc.
MIT
FAQs
A utility that lets you determine if a given date is a holiday and also show a greeting. Works until 2028, no API access required.
The npm package holiday-greetfinder receives a total of 4 weekly downloads. As such, holiday-greetfinder popularity was classified as not popular.
We found that holiday-greetfinder demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.