YearsDays .com
All Tools

Editorial & Mathematical Methodology

Published: November 9, 2026 • Lead Author: Chronometry Engineering Desk

1. Calendar Borrow Algorithm

Unlike naive subtraction methods that assume every month consists of 30 or 30.4375 days, our engine implements exact Gregorian calendar borrow arithmetic:

if (target.day < birth.day) {
const daysInPrevMonth = daysInMonth(target.year, target.month - 1);
days = target.day + daysInPrevMonth - birth.day;
months -= 1;
}

2. Leap Year & Century Rules

A year is a leap year if it is divisible by 4, except for end-of-century years, which must be divisible by 400.

  • 1900: Non-leap year (February has 28 days).
  • 2000: Leap year (February has 29 days).
  • 2100: Non-leap year (February has 28 days).
  • 2024: Leap year (February has 29 days).

3. Astronomical & Ephemeris Data Sources

Our Chinese Zodiac and astronomical benchmark engines rely on verified lookup tables and ephemerides:

  • Hong Kong Observatory (HKO) Gregorian-Lunar Calendar Conversion Tables (1901–2100).
  • Purple Mountain Observatory, Chinese Academy of Sciences (standard astronomical ephemeris).
  • Astronomical Applications Department of the U.S. Naval Observatory (USNO).

4. DST-Immune Day Totals

Total elapsed days, weeks, hours, and minutes are computed using UTC midnight day numbers (Date.UTC(y, m-1, d)). Because UTC has no daylight saving shifts (every UTC day is exactly 86,400,000 ms), day counts never suffer from 23-hour or 25-hour local clock adjustments.