Early history

The earliest evidence of the Chinese calendar is found on oracle bones of the Shang dynasty (late second millennium BC), which seem to describe a lunisolar year of twelve months, with a possible intercalary thirteenth, or even fourteenth, added empirically to prevent calendar drift. The Sexagenary cycle for recording days was already in use. Tradition holds that, in that era, the year began on the first new moon after the winter solstice.
Early Eastern Zhou texts, such as the Spring and Autumn Annals, provide better understanding of the calendars used in the Zhou dynasty. One year usually had 12 months, which were alternately 29 and 30 days long (with an additional day added from time to time, to catch up with “drifts” between the calendar and the actual moon cycle), and intercalary months were added in an arbitrary fashion at the end of the year.

By the beginning of the Warring States, progress in astronomy and mathematics allowed the creation of calculated calendars (where intercalary months and days are set by a rule, and not arbitrarily). The sìfēn 四分 (quarter remainder) calendar, which began about 484 BCE, was the first calculated Chinese calendar, so named because it used a solar year of 365¼ days (the same as the 1st century BCE Julian Calendar of Rome), along with a 19-year (235-month) Rule Cycle, known in the West as the Metonic cycle. The year began on the new moon preceding the winter solstice, and intercalary months were inserted at the end of the year. In 256 BC, as the last Zhou king ceded his territory to Qin, a new calendar (the Qin calendar) began to be used. It followed the same principles as the Sifen calendar, except the year began one month before (the second new moon before the winter solstice, which now fell in the second month of the year). The Qin calendar was used during the Qin dynasty, and in the beginning of the Western Han dynasty.
Taichu calendar
The Emperor Wu of the Western Han dynasty introduced reforms that have governed the Chinese calendar ever since. His Tàichū (太初, “Grand Inception”) calendar of 104 BCE had a year with the winter solstice in the eleventh month and designated as intercalary any calendar month (a month of 29 or 30 whole days) during which the sun does not pass a principal term (that is, remained within the same sign of the zodiac throughout). Because the sun’s mean motion was used to calculate the jiéqì (traditional Chinese: 節氣; simplified Chinese: 节气) (or seasonal markings) until 1645, this intercalary month was equally likely to occur after any month of the year. The conjunction of the sun and moon (the astronomical new moon) was calculated using the mean motions of both the sun and moon until 619, the second year of the Tang dynasty, when chronologists began to use true motions modeled using two offset opposing parabolas (with small linear and cubic components). Unfortunately, the parabolas did not meet smoothly at the mean motion, but met with a discontinuity or jump.
True sun and moon
With the introduction of European astronomy into China via the Jesuits, the motions of both the sun and moon began to be calculated with sinusoids in the 1645 Shíxiàn calendar (時憲書, Book of the Conformity of Time) of the Qing dynasty, made by the Jesuit Adam Schall. The true motion of the sun was now used to calculate the jiéqì, which caused the intercalary month to often occur after the second through the ninth months, but rarely after the tenth through first months. A few autumn-winter periods have one or two calendar months where the sun enters two signs of the zodiac, interspersed with two or three calendar months where the sun stays within one sign.
Gregorian Reform and the 1929 time change
The Gregorian calendar was adopted by the nascent Republic of China effective January 1, 1912 for official business, but the general populace continued to use the traditional calendar. The status of the Gregorian calendar was unclear between 1916 and 1921 while China was controlled by several competing warlords each supported by foreign colonial powers. From about 1921 until 1928 warlords continued to fight over northern China, but the Kuomintang or Nationalist government controlled southern China and used the Gregorian calendar. After the Kuomintang reconstituted the Republic of China October 10, 1928, the Gregorian calendar was officially adopted, effective 1 January 1929. Along with this, the time zone for the whole country was adjusted to the coastal time zone that had been used in European treaty ports along the Chinese coast since 1904. This changed the beginning of each calendar day, for both the traditional and Gregorian calendars, by plus 14 minutes and 26 seconds from Beijing midnight to midnight at the longitude 120° east of Greenwich. This caused some discrepancies, such as with the 1978 Mid-Autumn Festival. There was a new moon on September 3, 1978, at 00:07, China standard time. Using the old Beijing timezone, the New Moon occurred at 23:53 on the 2nd, so the eighth month began on a different day in the calendars. Thus people in Hong Kong (using the traditional calendar) celebrated the Festival on 16 September, but those in the mainland celebrated on 17 September.