The earliest calendars were lunar because the Moon's waxing and waning phases are unmistakable without instruments. Yet a purely lunar year of 12 months drifts backward through the seasons by roughly 11 days every year.
Babylonian astronomers solved this by inserting an extra month seven times every 19 years (the Metonic cycle). Meanwhile, ancient Egyptians tracked the heliacal rising of Sirius to anchor a 365-day solar calendar tied to the Nile flood.
In 45 BCE, Julius Caesar—advised by Sosigenes of Alexandria—established the 365.25-day Julian calendar, refined in 1582 by Pope Gregory XIII to remove 3 leap days every 400 years.
