Before the Gregorian calendar became the dominant way of counting days, each part of the world used a different type of calendar. One of the most popular was the lunar calendar.
People began using the lunar calendar before agriculture became the dominant means of food production in society because it was easy to count the days of the month by the shape of the moon. The average period of the moon’s revolution about the Earth is exactly 29.530589 days. Therefore, months would alternate between 29 or 30 days, resulting in 354 days per year (six months of 29 days and six months of 30 days). This led to problems as the revolution period of the Earth around the sun is about 365 days, and months representing the seasons shift as the one-day difference accumulates. People corrected the shift by adding a 13th month to seven of every 19 years, accounting for eleven lost days. This system became confusing once people began farming as months did not correspond to seeding or harvesting cycles.
While some cultures were developing ways to synchronize the lunar calendar with their agricultural cycle, others decided to base their calendar on the solar cycle. Since the Earth’s period of revolution around the sun is precisely 365.2422 days, the solar calendar included six months with 30 days and six months with 31 days, resulting in 365 total days per year. In the 16th century Pope Gregory XIII corrected the discrepancy between the solar revolution period and calendar year by adding one day to every fourth year, known as a leap year. These additional days were to be skipped once every century, in a year called lop leap year. With these corrections, 0.875 days went missing every 400 years, so Gregory chose to add one day every 400 years in a year called loop lop leap year. After all these measures, the discrepancy is still not perfectly corrected. The difference is negligible, however, and thus Gregory’s calendar became the Gregorian calendar we use today.