§ 3 of the German Maternity Protection Act sets two periods and a bridge between them. The one before birth starts six weeks — 42 calendar days — ahead of the expected date of delivery as certified by a doctor or a midwife, and the day of birth itself is not counted in that reckoning. It ends when the child arrives, whenever that is.
The one after birth runs eight weeks from the day of birth, or twelve for a premature or multiple birth. Twelve also applies where a disability is medically established in the child, but only if the woman applies for it. The bridge is the sentence most people miss: if the child comes before the due date, the period after birth is extended by exactly the days lost from the period before.
It can never gain more than 42, because the earlier period never had more than that. If the child comes late, the period before birth simply runs on to the actual delivery, and the eight weeks after stay eight weeks. What is not modelled here: stillbirth, the death of the child and miscarriage fall under separate subsections with their own periods.
Nor is the express declaration with which a woman may keep working during the six weeks before the birth. And the sentence that matters most: your health insurer and your employer do the binding calculation. This page reproduces it.