How to Check if a Date is a Business Day in Any Country (With Code Examples)

Published: (April 17, 2026 at 02:51 PM EDT)
3 min read
Source: Dev.to

Source: Dev.to


⚠️ Collection Error: Content refinement error: Error: 429 “you (bkperio) have reached your session usage limit, upgrade for higher limits: https://ollama.com/upgrade (ref: 3494e77a-c3d9-4d89-9b22-f9ca2e046cfd)”


Building an app that handles scheduling, invoicing, or delivery estimates? You’ll need to know if a given date is a business day - and that’s trickier than it sounds when you’re dealing with multiple countries. A “business day” isn’t universal: Weekends vary: Saturday-Sunday in most countries, Friday-Saturday in UAE/Israel Public holidays differ: France has 11, Japan has 16, the US has 11 federal holidays Regional holidays exist: Bavaria (Germany) has holidays that don’t apply in Berlin Writing this logic from scratch means maintaining holiday calendars for 100+ countries. That’s a maintenance nightmare. Instead of hardcoding holiday data, call an API that handles it for you. Here’s how to check if a date is a business day using the Public Holidays & Business Days API: const response = await fetch( ‘https://public-holidays-business-days-api.p.rapidapi.com/is-business-day?country=FR&date=2026-05-01’, { headers: { ‘X-RapidAPI-Key’: ‘YOUR_API_KEY’, ‘X-RapidAPI-Host’: ‘public-holidays-business-days-api.p.rapidapi.com’ } } );

const data = await response.json(); console.log(data); // { // “date”: “2026-05-01”, // “country”: “FR”, // “isBusinessDay”: false, // “reasons”: [{ “type”: “public_holiday”, “name”: “Labour Day”, “localName”: “Fête du Travail” }] // }

import requests

response = requests.get( ‘https://public-holidays-business-days-api.p.rapidapi.com/is-business-day’, params={‘country’: ‘FR’, ‘date’: ‘2026-05-01’}, headers={ ‘X-RapidAPI-Key’: ‘YOUR_API_KEY’, ‘X-RapidAPI-Host’: ‘public-holidays-business-days-api.p.rapidapi.com’ } )

data = response.json() print(f”Is business day: {data[‘isBusinessDay’]}“)

Is business day: False

Need to calculate “delivery in 5 business days”? The API handles that too: const response = await fetch( ‘https://public-holidays-business-days-api.p.rapidapi.com/next-business-day?country=US&date=2026-12-23&days=3’, { headers: { ‘X-RapidAPI-Key’: ‘YOUR_API_KEY’, ‘X-RapidAPI-Host’: ‘public-holidays-business-days-api.p.rapidapi.com’ } } );

const data = await response.json(); console.log(data.nextBusinessDays); // [“2026-12-26”, “2026-12-29”, “2026-12-30”] // (skips Dec 24-25 Christmas holidays and weekends)

Get all holidays for a country and year: const response = await fetch( ‘https://public-holidays-business-days-api.p.rapidapi.com/holidays?country=DE&year=2026’, { headers: { ‘X-RapidAPI-Key’: ‘YOUR_API_KEY’, ‘X-RapidAPI-Host’: ‘public-holidays-business-days-api.p.rapidapi.com’ } } );

const data = await response.json(); console.log(Germany has ${data.count} public holidays in 2026);

You could use libraries like date-holidays (npm) or holidays (Python), but: Data gets stale - holidays change (UK added a bank holiday in 2022 for the Queen’s funeral) Edge cases - some holidays are “observed” on different days when they fall on weekends Regional variations - the API handles sub-regions (US states, German Länder) An API abstracts this complexity. You get accurate, up-to-date data without maintaining it yourself. The WorkDay API offers: Free tier: 1,000 requests/month (enough for testing) Pro: $9/month for 25,000 requests Ultra: $29/month for 200,000 requests Compare that to building and maintaining your own holiday database across 100+ countries. Sign up on RapidAPI

Subscribe to the Public Holidays & Business Days API (free tier available) Make your first request Building something that needs business day calculations? Drop a comment - I’d love to hear your use case.

0 views
Back to Blog

Related posts

Read more »