How 'Days Until' Calculators Compute Moving Holidays (Easter, Thanksgiving)
Ask a countdown tool "how many days until Christmas" and the answer is easy — Christmas is always December 25. Ask it for Easter or Thanksgiving and something more interesting has to happen behind the scenes, because those dates move every single year. This guide opens up how a good countdown computes moving holidays instead of cheating with a hardcoded lookup table.
Fixed holidays vs moving holidays
Holidays fall into two families, and only one of them is trivial.
Fixed-date holidays land on the same calendar date every year: Christmas (Dec 25), Halloween (Oct 31), New Year's Day (Jan 1), Juneteenth (Jun 19). For these a countdown just builds the target date for the current year and subtracts. The only wrinkle is that once the date passes, you have to roll to next year's occurrence (more on that below).
Moving holidays are defined by a rule, not a date. Easter is "the first Sunday after the first full moon on or after the spring equinox." Thanksgiving in the US is "the fourth Thursday of November." The solstices drift by a day or so because the tropical year isn't a whole number of days. A countdown that hardcodes "Easter 2026 = April 5" will silently produce wrong answers the moment the year turns over. The correct approach is to compute the date from its rule every time.
Easter: the computus (Meeus/Jones/Butcher)
Easter is the hardest of the common holidays because its rule mixes the solar calendar with an ecclesiastical approximation of lunar phases. The algorithm that resolves it is called the computus, and the version almost everyone uses is the Anonymous Gregorian algorithm popularized by Jean Meeus and by Jones & Butcher. It is pure integer arithmetic — no astronomy tables, no floating point — and it returns the correct Western (Gregorian) Easter Sunday for any year.
Here is the whole thing:
a = year mod 19
b = year div 100
c = year mod 100
d = b div 4
e = b mod 4
f = (b + 8) div 25
g = (b - f + 1) div 3
h = (19a + b - d - g + 15) mod 30
i = c div 4
k = c mod 4
l = (32 + 2e + 2i - h - k) mod 7
m = (a + 11h + 22l) div 451
month = (h + l - 7m + 114) div 31 # 3 = March, 4 = April
day = ((h + l - 7m + 114) mod 31) + 1
The intuition: a is the year's position in the 19-year Metonic cycle (the moon's phases nearly repeat every 19 years); h locates the ecclesiastical full moon; and l steps forward to the following Sunday. The b/d/f/g terms apply the Gregorian corrections that keep the calendar aligned with the real equinox over centuries.
Worked example — Easter 2027. Feed year = 2027 through the steps: a = 13, b = 20, c = 27, h = 1, l = 5, m = 0, which gives month = (1 + 5 − 0 + 114) div 31 = 120 div 31 = 3 and day = (120 mod 31) + 1 = 27 + 1 = 28. So Easter Sunday 2027 falls on March 28 — and the same nine lines will hand you 2028, 2050, or 2100 without a data update. Western Easter always lands somewhere between March 22 and April 25; anything outside that window is a bug.
Thanksgiving and other "nth weekday" holidays
A second big family of moving holidays is defined as "the Nth weekday of a month." These are much simpler than Easter — you just find the first occurrence of the target weekday, then jump ahead in 7-day steps.
- US Thanksgiving = the 4th Thursday of November. For 2026 the first Thursday is Nov 5, so the fourth is November 26, 2026.
- Canadian Thanksgiving = the 2nd Monday of October.
- US federal holidays like Martin Luther King Jr. Day (3rd Monday of January) and Memorial Day (last Monday of May) use the same shape.
The general recipe: take the 1st of the month, find how far it is to the desired weekday, add that offset, then add (N − 1) × 7 days. "Last weekday of the month" is the same trick run backward from the last day.
Solstices and seasons
"How many days until summer" points at a solstice, and those aren't fixed either — the June solstice can fall on the 20th or 21st depending on the year and your time zone. A countdown uses the astronomical approximations (spring ≈ Mar 20, summer ≈ Jun 21, autumn ≈ Sep 22, winter ≈ Dec 21 in the Northern Hemisphere) and, ideally, flips them for the Southern Hemisphere, where June is midwinter. Labeling the hemisphere matters: "summer" is not a global date.
Auto-rolling to the next occurrence
Every recurring event needs a rule for which occurrence you mean. If it's July and you ask "days until Christmas," you want this December. If it's late December and Christmas has passed, you almost certainly mean next year. The pattern is:
- Compute the event for the current year using its rule (fixed date, computus, or nth-weekday).
- If that date is already in the past, recompute for
year + 1and use that.
Because moving holidays are computed rather than stored, auto-rolling is free — the same nine-line computus that gives you Easter 2027 gives you Easter 2028 by passing a different year. To count in the other direction — "how many days since an anniversary or a birthday" — the mirror logic applies, which is exactly what the age calculator does when it breaks an elapsed span into years, months, and days.
Why the math runs in UTC
The last piece is subtle and it's where naive countdowns go wrong: daylight saving time. If you compute "days remaining" by subtracting two local timestamps, a spring-forward or fall-back day is only 23 or 25 hours long, and dividing the millisecond gap by 86,400,000 can round to the wrong number of days. It can even make a countdown flicker off-by-one at midnight.
The fix is to do the day arithmetic on UTC midnights. Anchor both "today" and the target to midnight UTC, subtract, and divide — the count of calendar days is then exact regardless of any DST transition in between. The live hours/minutes/seconds ticker can still run in local time; it's only the day count that must be DST-safe.
A concrete count: from June 24, 2026 to Christmas (Dec 25, 2026) is 184 days. Compute it on UTC midnights and you get 184 every time; compute it across a November DST change on naive local times and you risk 183 or 185.
Putting it together
A trustworthy "days until" tool is really three small engines wired together: a fixed-date builder, an nth-weekday finder, and the computus for Easter — each producing a UTC-anchored target date, with auto-roll deciding which occurrence you meant. Get those right and every holiday, every year, comes out correct without anyone editing a table. Try it on your own event below.
Sources: the Computus / Anonymous Gregorian algorithm (en.wikipedia.org/wiki/Computus); timeanddate.com countdown reference. Easter and Thanksgiving dates are computed from their rules, not hardcoded.