A more important problem is making the lunar calendar agree with the seasons. The answer is quite complicated because it depends upon the paths and velocities of the moon and sun. The lunar calendar contained extra months intercalated so that 7 such intercalations in each 19 years just about(almost) kept the lunar calendar in time with the solar year. Thus 235 lunar months were equal to 19 solar years.