The Hebrew calendar is a lunisolar calendar which depends on both the moon and the sun. Months of the Hebrew calendar are based on the appearance of the new moon. At the same time, the holiday of Passover must be in the spring. For this reason, years of the Hebrew calendar are based on the sun.
One solar (sun-based) year lasts about 365 days, but twelve lunar (moon-based) months only last about 354 days. For this reason, the Hebrew calendar adds an extra lunar month seven times in each cycle of 19 years. This rule makes the average Hebrew calendar year about the same length as a solar year, 365 days.
The seven-day week is used to figure out the day for Shabbat, the day of rest. The week does not depend on the solar year or lunar month. Instead, it depends on a count of seven days that is believed to go back to ancient times. The week is also an important part of the Hebrew calendar.