DEV Community

Miha Smrekar
Miha Smrekar

Posted on

Deterministic business-day calculations across time zones

There are good libraries and APIs for holidays, business days, working-day calculations, and timezone handling.

I built an API called Datewise for a narrower problem: when the answer has to be reproducible later.

Business-day and working-hours calculations depend on inputs that can change over time:

holiday rules, observed days, substitute holidays, weekends, and timezone data.

That means a stored calculation can become hard to audit later unless you also know which calendar dataset was used at the time.

Datewise returns the calendar dataset version and the IANA timezone-data version used for each calculation, so the calendar and timezone inputs behind the result are explicit.

Example:

GET https://datewise.dev/v1/is-business-day?country=US&date=2026-07-03
Enter fullscreen mode Exit fullscreen mode
{
  "date": "2026-07-03",
  "is_business_day": false,
  "reason": "holiday",
  "holiday": {
    "date": "2026-07-03",
    "name": "Independence Day",
    "observed": true,
    "substitute_of": "2026-07-04",
    "type": "public"
  },
  "meta": {
    "dataset_version": "2026.2",
    "tzdata_version": "2026a",
    "country": "US",
    "weekend": [6, 7]
  }
}
Enter fullscreen mode Exit fullscreen mode

I am looking for feedback from people who have had to solve this in production.

How do you handle corporate date arithmetic logic?

Do you version your calendar or holiday data?

Would a service like this be useful in your workflow? Why or why not?

Methodology: https://www.datewise.dev/methodology
API: https://www.datewise.dev/

Top comments (0)