6 month window (actually 7). 3 months before through 3 months after plus the month of your 65th birthday.
Also, it begins on the first day of the month you turn 65.
It’s messed up that you are forced to pay into it over your entire life, are forced to pay almost $200/month for it once you turn 65, AND the coverage is so crappy you’ll need to buy an advantage or supplemental plan as well from private insurers to get adequate coverage. So plan on spending about $5,000-$8,000/year for your government sponsored healthcare.