
Security News
Nx npm Packages Compromised in Supply Chain Attack Weaponizing AI CLI Tools
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
The national holidays data used in this gem comes from the national-holidays-config project.
gem install national_holidays
This project uses git submodules, so the first time you clone the repository you will need to run:
git submodule init
Then to keep the config up to date use:
git pull --recurse-submodules
And to actually pull in new config use:
git submodule foreach git pull origin main
Then to publish:
gem build national_holidays.gemspec
gem push national_holidays-{VERSION}.gem
rm national_holidays-{VERSION}.gem
require 'national_holidays'
NationalHolidays.load! # optionally pre-load all data
NationalHolidays.countries.each do |country|
country.regions.each do |region|
holidays = region.all_holidays.select { |h| h.date.day == 18 && h.date.month == 11 }
if holidays.any?
puts "My birthday is a public holiday in #{country.name}: #{holidays.first.names.except(:en).first.last}!"
end
end
end
# My birthday is a public holiday in Haiti: Vertières Day!
# My birthday is a public holiday in Iran (Islamic Republic of): Martyrdom of Imam Reza!
# My birthday is a public holiday in Latvia: Latvijas Republikas proklamēšanas diena!
# My birthday is a public holiday in Mexico: Revolución Mexicana!
country = NationalHolidays::Country.new(:gb)
puts country.code
# gb
puts country.name
# United Kingdom of Great Britain and Northern Ireland
puts country.regions.map(&:name)
# ["England", "Wales", "Scotland", "Northern Ireland"]
Country names come from https://github.com/hexorx/countries
Region names come from https://github.com/CharlieHR/national-holidays-config
region = NationalHolidays::Region.new(:united_states14)
puts region.code
# :united_states14
puts region.name
# Illinois
date = Date.new(2018, 1, 1)
puts region.all_holidays.count
# 374
puts region.holidays_on_or_before(date).count
# 87
puts region.holidays_before(date).count
# 86
puts region.holidays_on_or_after(date).count
# 288
puts region.holidays_after(date).count
# 287
puts region.holidays_between(date, date).count
# 1
holiday.names
# {
# en: "New Year's Day",
# es: "Año Nuevo"
# }
holiday.date
# Date.new(2018, 1, 1)
holiday.public_holiday?
# true
In the future we hope to also support non-public holidays, ie. days which are notable but do not mean that people get the day of work.
We run CharlieHR where knowing about public and national holidays helps us calculate time off for 1000s of companies.
FAQs
Unknown package
We found that national_holidays demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Security News
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.