Calculating HSA and 6 month lookback, to stop contributions

I want to stop my HSA contributions before the 6 month lookback day, but I am confused about which day to count back from.  Is it 6 months before the requested date for Medicare to START, or is it 6 months before the day you APPLY (make the request)? If I request a Medicare start date of July 1, but I make that request on May 1 (2 months before Medicare actually starts), does that make the 6 months lookback start on Jan 1 of the retirement year, or do I have to back up an additional 2 months to November 1 of the previous year?