惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
人人都是产品经理
人人都是产品经理
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
Microsoft Security Blog
Microsoft Security Blog
IT之家
IT之家
M
MIT News - Artificial intelligence
S
SegmentFault 最新的问题
H
Hackread – Cybersecurity News, Data Breaches, AI and More
AI
AI
I
InfoQ
博客园_首页
T
Threatpost
Know Your Adversary
Know Your Adversary
T
Tenable Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
NISL@THU
NISL@THU
V
Vulnerabilities – Threatpost
The Hacker News
The Hacker News
N
News and Events Feed by Topic
O
OpenAI News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
TaoSecurity Blog
TaoSecurity Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
W
WeLiveSecurity
Hacker News - Newest:
Hacker News - Newest: "LLM"
K
Kaspersky official blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Help Net Security
Help Net Security
Hacker News: Ask HN
Hacker News: Ask HN
C
CERT Recently Published Vulnerability Notes
H
Heimdal Security Blog
A
About on SuperTechFans
The Last Watchdog
The Last Watchdog
腾讯CDC
Jina AI
Jina AI
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
Security Latest
Security Latest
Recorded Future
Recorded Future
量子位
有赞技术团队
有赞技术团队
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
The date bug that cost us a $120K contract and what i built to make sure it never happens again
Blues Clues · 2026-05-04 · via DEV Community

I still remember where i was when the email came in.

December 25th. Christmas morning. Phone in hand while having breakfast, and there is an email from our client's CTO. No greetings, Just

"We're terminating the contract. Our legal team will be in touch"

We lost a 120K a year contract. On a Christmas morning because of a date calculation bug that none of us, not a person on a team of 5 experienced developers had ever experienced.

Here's what happened

The file nobody wanted to touch
Every engineering team I've ever been on had a file similar to this. Ours was business_day_utils.py. It was 1,847 lines long and had a comment at the top that read:

# WARNING: Do not refactor. Do not "improve". Do not touch.
# This file has been through 3 rewrites. All 3 failed.
# If you think you understand it, you don't. 
# - James, 2021

Enter fullscreen mode Exit fullscreen mode

It handled our SLA deadline calculations for a Fintech client operating across Germany, the Netherlands and Saudi Arabia. It had bugs, we knew it had bugs. We just didn't know where they were.

The file calculated business days. Simple enough, right? Skip weekends, skip public holidays and return the correct datetime. Every calendar library we used agreed. Every timezone check passed, the unit tests passed. The staging environment looked fine.

On December 24th, 2022, our system calculated that a batch of payment overdue notices should go out that afternoon. 50,000 of them to customers of a German bank.

The calculation was correct by every measure we had. Except one.

What no library told us

In German banking, December 24th Heiligabend, Christmas Eve ends at noon

Not a public holiday, not a weekend. A half day. It's documented in the Bundesbank TARGET2 closure calendar. A PDF in German. On the Bundesbank website, something that is apparently common knowledge in German banking circles and completely invisible to every date library, every timezone package and every "Business Days" function ever written.

Our system didn't know, so it sent the notices.

50,000 wrong SLA breach notifications went to customers of a German bank on a day that, in German banking had effectively ended at 12pm.

The bank's CTO found out that evening. The termination email arrived the next morning.

We found out on Christmas Day.

The week after
I spent the week between Christmas and New year doing one thing: looking for a solution that would have prevented this.

I needed something that knew:

  • National public holidays(Obviously)

  • Sub national holidays: Bavaria has different public holidays than Berlin . Most libraries treat "Germany" as a single thing. It isn't

  • Half days: Christmas Eve in German banking, New Year's Eve in German banking and NYSE early close days. These exist, they matter and nobody covers them.

  • The Gulf work week: Saudi Arabia, UAE, Qatar all use Friday/Saturday as their weekend, not Saturday/Sunday. Also, Saudi Arabia changed its weekend on June 29th 2013, from Thursday/Friday to Friday/Saturday. Royal Decree M/46. Most libraries I tested in 2022 still had the wrong dates.

  • Substitute holidays: When a holiday falls on a weekend, the observed day shifts. Different countries handle this differently. Japan's rules are particularly complicated.

  • DST-safe arithmetic: Adding "8 business hours" across a clock change boundary is not the same as adding 8 * 3600 seconds. We'd been getting this wrong too, we just hadn't caught it yet.

  • An audit trail: Something I could actually show a lawyer or a compliance officer that explained exactly why a deadline was calculated the way it was.

I found nothing that did all of this. I found things that did some of it. I found libraries that required me to maintain the holiday database myself (the whole problem). I found APIs that covered 60 countries with no sub-national support.

I didn't find what I was looking for.

So I built it
I want to be honest about something. I didn't build this because I had a great product idea. I built it because I was angry and embarrassed and I never wanted to be responsible for a situation like that again.

A global business day API. One endpoint. You POST a datetime, a jurisdiction, and an offset. You get back the resolved datetime plus a complete audit trail of everything that was skipped and why.

This is what the response looked like for the exact call that would have saved us:

POST /v1/resolve
{
  "from": "2024-12-24T09:00:00Z",
  "timezone": "Europe/Berlin",
  "jurisdiction": "DE/BY",
  "add_business_hours": 8,
  "calendar": "banking"
}

Enter fullscreen mode Exit fullscreen mode

{
  "result": "2024-12-27T13:00:00+01:00",
  "skipped": [
    {
      "date": "2024-12-24",
      "reason": "Heiligabend — banking half-day",
      "type": "half_day",
      "hours_lost": 4.0,
      "source": "https://www.bundesbank.de/en/tasks/payment-systems/target2/calendar"
    },
    {
      "date": "2024-12-25",
      "reason": "Christmas Day",
      "type": "public_holiday",
      "source": "https://www.bmi.bund.de/feiertage"
    },
    {
      "date": "2024-12-26",
      "reason": "Boxing Day",
      "type": "public_holiday",
      "source": "https://www.bmi.bund.de/feiertage"
    }
  ],
  "jurisdiction_verified": true,
  "engine_version": "2025-04"
}

Enter fullscreen mode Exit fullscreen mode

See that source field? That's the Bundesbank calendar. The actual government document. In the API response. So if anyone ever asks why your SLA deadline was calculated the way it was, you have a timestamped JSON record pointing to the official source.

That field alone would have saved our contract.

What it covers
I'll be honest, building this was not fun. Maintaining verified holiday data for 150 countries across different government publication formats, in different languages, with different update schedules, it's an unglamorous data operation that never ends. Governments change dates. Parliaments pass new legislation. The Saudi weekend switch in 2013 that I mentioned, most libraries still get that wrong in 2026 because nobody is maintaining the data seriously.

Here's what's currently covered:

  • 150 countries: National calendars

  • All 50 US states: Texas Independence Day is March 2nd and it matters if your customer is a Texas government contractor

  • German Länder: Bavaria, Berlin, NRW, Hamburg, all of them, separately

  • Swiss cantons: Geneva and Zurich have different rules

  • Australian states: Queensland and Victoria are different

  • Canadian provinces: Ontario and Quebec are different

  • Gulf states: Saudi Arabia, UAE, Qatar, Bahrain, Kuwait: Friday/Saturday work week with the correct 2013 cutover date

  • Islamic holidays: Eid al-Fitr, Eid al-Adha, Islamic New Year pre-computed through 2040

  • Industry calendars: Banking, NYSE, LSE, TSX, healthcare, logistics, government

  • Half days: Heiligabend, Silvester (German banking), NYSE July 3rd early close, NYSE day after Thanksgiving, LSE Christmas Eve and New Year's Eve

  • Substitute holidays: When holidays fall on weekends, computed correctly per jurisdiction

  • DST safe arithmetic: Minute level precision across clock changes

Stateless. No database. The full dataset compiles into memory at startup.

Integrating takes 3 lines

Python

import httpx

r = httpx.post(
    "https://business-datetime-resolution-api.p.rapidapi.com/resolve",
    json={
        "from": "2024-12-24T09:00:00Z",
        "timezone": "Europe/Berlin",
        "jurisdiction": "DE/BY",
        "add_business_hours": 8,
        "calendar": "banking"
    },
    headers={
        "X-RapidAPI-Key": "YOUR_KEY",
        "Content-Type": "application/json"
    }
)

print(r.json()["result"])
# → "2024-12-27T13:00:00+01:00"

Enter fullscreen mode Exit fullscreen mode

or JavaScript

const r = await fetch("https://business-datetime-resolution-api.p.rapidapi.com/resolve", {
  method: "POST",
  headers: {
    "X-RapidAPI-Key": "YOUR_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    from: "2024-12-24T09:00:00Z",
    timezone: "Europe/Berlin",
    jurisdiction: "DE/BY",
    add_business_hours: 8,
    calendar: "banking"
  })
});

const { result } = await r.json();

Enter fullscreen mode Exit fullscreen mode

It's on RapidAPI with a free tier. 500 calls per month, no card required. After that it's $0.003 per call. A developer running 10,000 calls per month pays $30. For a mid-size SaaS processing 100,000 transactions per day, it's less than one junior engineer's weekly salary.

→ Get your free API key on RapidAPI

The thing I keep thinking about
Building this, I spoke to maybe 40 or 50 developers about business day calculations. The stories I heard were extraordinary.

One engineer told me about a payroll system that paid employees on a Saudi national holiday for three years before anyone noticed. Another described a logistics platform that had been showing wrong delivery ETAs every December for five years, they'd just gotten used to the customer service spike.

The most common thing I heard was some version of: "We have a file for that. Nobody touches it."

Every company has the file. The file is never fully correct. Nobody wants to fix the file because the last person who tried is no longer employed there.

I built the API so the file can die.

Edge cases I learned the hard way
A few things that surprised me during the build, in case they're useful:

  • Japan's substitute holiday system is uniquely complicated. Japan has "substitute holidays" (振替休日) when a public holiday falls on Sunday, but it also has "citizens' holidays" (国民の祝日) when a regular day gets squeezed between two public holidays. The rules for this have changed multiple times since 1985.

  • Saudi Arabia's work week changed mid year in 2013. Royal Decree M/46, effective June 29th, 2013. Before that date, the weekend was Thursday/Friday. After, it became Friday/Saturday. If you're calculating a business deadline that straddles that date which is unlikely but not impossible for multi-year contracts you need to know the exact cutover.

  • Christmas Eve in German banking is a partial day, not a full holiday. This is documented in the Bundesbank's TARGET2 calendar. The TARGET2 payment system closes at noon on December 24th. Most date libraries do not know this exists. We learned this the way I described above.

  • NSW and Queensland have different public holidays on the same day sometimes. Australia Day (January 26th) observance varies by state. When it falls on a weekend, each state independently decides when to observe it.

  • DST transitions in the US happen at 2am local time. Adding "8 business hours" starting at 11pm on the night before a spring forward results in an ambiguous calculation that most libraries handle incorrectly.

One last thing
If you've read this far and you're thinking "we have a file like this". I'd genuinely like to hear about it. I'm just collecting edge cases and some of the ones I've heard are remarkable.

Drop a comment below. And if the API is useful, it's at the link above.

I'm sorry it took losing a $120k contract to build it. I'm glad it exists now.

API is available on RapidAPI. Free tier: 500 calls/month. No card required.→ Get your free API key on RapidAPI