[noun (time)] + までに [verb (dictionary form)] + までに
までに means "by": it sets a deadline, and the action happens once, at some point before it. It follows a time noun, or a verb in the dictionary form for "by the time".
Anything that happens once – arriving, handing in, deciding – needs までに.
The verb stays in the dictionary form even when the sentence is in the past.