D-Day Calculator

Calculate days until a deadline, birthday, vacation, exam, event or other target date.

// about

About this Tool

A D-Day calculation compares today with a target date and tells you how many calendar days remain or have passed.

How to use it

  1. Choose the target date.
  2. Select Calculate D-Day.
  3. Read the remaining or elapsed day count.

Why people use this tool

  • Useful for deadlines, exams, trips, birthdays, launches, and appointments.
  • Clearly distinguishes future dates from dates that have already passed.
  • Uses calendar dates without confusing the result with hours and minutes.
Guides · Date & time · 7 min read

Date Calculations Without the Off-by-One: D-Days, Anniversaries, Age and Months Old

How many days until the exam? When is the 100th day? How many months old is the baby? Date maths is full of one-day differences, so it pays to know the rule being used.

D-day counting labels the target date D, the day before D-1 and the day after D+1. The days remaining are simply target date minus today. On 28 October 2026, 25 December is D-58.

Start: 2026-03-01
Elapsed days: 2026-06-08 is 99 days after the start
Day number:   2026-06-08 is the 100th day
How counting the first day changes D-day and anniversary results, how to calculate age in years, and how calendar-month ages and month-end dates work.
Read guide →
Build it with AI

Build this tool yourself with AI

Want your own version of this tool? Copy the work-order prompt into an AI chat, or save the skill file for an AI coding agent. Both describe the features, edge cases and test cases we used when building it.

AI work-order prompt

Paste it as-is into an AI chat such as Claude, ChatGPT or Gemini.

You are an experienced full-stack web developer. Build a web tool called "D-Day Calculator" that meets the requirements below.

## Goal

Build a tool that shows the days remaining until, or elapsed since, a target date in D-day format.

## Core features

- Show D-n, D-Day or D+n for a target date
- Change the reference date
- 'Day number' mode that counts the first day
- Generate milestone lists such as day 100 or 1,000
- Copy the result sentence

## Inputs

- Target date
- Reference date (default today) and mode

## Outputs

- D-day label
- Days remaining or elapsed
- Milestone list

## Edge cases and handling rules

- Compare calendar dates only, not times
- Determine 'today' in the user's time zone
- Handle 29 February in leap years
- Show 'D-Day' when the target is today

## Implementation requirements

- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.
- Make the UI responsive and easy to use on mobile; label every input and keep everything keyboard accessible.
- Add a Copy button for results and show clear, friendly error messages for invalid input.
- Keep the core logic in functions separate from the UI so it can be unit-tested.

## Definition of done (test cases)

- From 2026-10-28, 2026-12-25 is D-58
- Day 100 from 2026-03-01 is 2026-06-08
- Same date shows D-Day

First outline your implementation plan in at most five lines, then write the complete code, and finally explain how to check the test cases above.

Skill (SKILL.md)

Save it as .claude/skills/build-d-day-calculator/SKILL.md for AI coding agents such as Claude Code to reuse whenever you build or change this tool.

---
name: build-d-day-calculator
description: Use when building or changing a D-Day Calculator tool. Build a tool that shows the days remaining until, or elapsed since, a target date in D-day format.
---

# Build: D-Day Calculator

## Goal

Build a tool that shows the days remaining until, or elapsed since, a target date in D-day format.

## Workflow

1. Review the required features, inputs and outputs below and ask about anything missing first.
2. Implement the core logic as pure functions separate from the UI.
3. Check the logic against the test cases in the verification list.
4. Build a responsive UI with an input form, a result area and a Copy button.
5. Reproduce each edge case listed under Rules and refine the error messages.

## Core features

- Show D-n, D-Day or D+n for a target date
- Change the reference date
- 'Day number' mode that counts the first day
- Generate milestone lists such as day 100 or 1,000
- Copy the result sentence

## Inputs

- Target date
- Reference date (default today) and mode

## Outputs

- D-day label
- Days remaining or elapsed
- Milestone list

## Rules

- Compare calendar dates only, not times
- Determine 'today' in the user's time zone
- Handle 29 February in leap years
- Show 'D-Day' when the target is today
- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.

## Verification

- [ ] From 2026-10-28, 2026-12-25 is D-58
- [ ] Day 100 from 2026-03-01 is 2026-06-08
- [ ] Same date shows D-Day

Tips for working with AI

  • Tell the AI your stack (for example React, Vue or plain HTML) on the first line so the code matches your project.
  • Ask it to run the listed test cases and show the results before you accept the code.
  • Never paste real secrets, customer data or API keys into the prompt; use sample values instead.