public-holidays-js
public-holidays-js copied to clipboard
Option to exclude observances
Google's calendars include significant days which are not actually public holidays. For example, from https://calendar.google.com/calendar/ical/en.za%23holiday%40group.v.calendar.google.com/public/basic.ics for South Africa:
BEGIN:VEVENT
DTSTART;VALUE=DATE:20240718
DTEND;VALUE=DATE:20240719
DTSTAMP:20240614T130816Z
UID:[email protected]
CLASS:PUBLIC
CREATED:20240530T091720Z
DESCRIPTION:Observance\nTo hide observances\, go to Google Calendar Setting
s > Holidays in South Africa
LAST-MODIFIED:20240530T091720Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Nelson Mandela Day
TRANSP:TRANSPARENT
END:VEVENT
This is included in the output of getHolidays({ country: 'za', lang: 'en' })
with no way to distinguish it from a "proper" public holiday:
{
"date": "2024-07-17T22:00:00.000Z",
"name": "Nelson Mandela Day"
}
We would really like the ability to exclude these "observances".
For comparison, "proper" public holidays in Google's calendars seem to have DESCRIPTION:Public holiday
. To complicate matters though, this is language-dependent... For example from https://calendar.google.com/calendar/ical/fr.french%23holiday%40group.v.calendar.google.com/public/basic.ics:
BEGIN:VEVENT
DTSTART;VALUE=DATE:20240714
DTEND;VALUE=DATE:20240715
DTSTAMP:20240614T132655Z
UID:[email protected]
CLASS:PUBLIC
CREATED:20240522T110451Z
DESCRIPTION:Jour férié
LAST-MODIFIED:20240522T110451Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:La fête nationale
TRANSP:TRANSPARENT
END:VEVENT
Perhaps the simplest would be to just include the "description" field (maybe only before the first \n
) in the output from this library, and let the application filter on that.