When do the residency requirements have to be met?

You are allowed to file the naturalization application up to three months before you will meet the residency requirements.