Electric vehicles (EV) pave a promising way towards low-carbon transportation, but the transition to all EV fleets creates new challenges for the public transportation sector. Despite increasing adoption of electric buses, the main challenges presented by the battery electric bus technology include the lack of charging facilities, the reduced operating capacity per battery charge compared to fossil-fuel vehicles, and weather-induced degradation. Thus, the joint planning of electric bus fleets and charging infrastructure are essential to guarantee energy security of the transport service and the parsimony of investment. In this paper, we propose a multi-period investment model in which the transition to a 100\% electric bus fleet and the expansion of the depot and on-route charging facilities are carried out jointly and gradually through bus retirement targets or annual budget constraints. An important feature of our model is the representation of two optimization time scales, one referring to yearly investment and the other to hourly operation; moreover, the hourly operation model captures the cyclic nature of the bus schedules as well as various EV charging strategies. We characterize the computational complexity of the proposed model and identify polynomially solvable problem subclasses. A primal heuristic algorithm is proposed that can significantly speed up Gurobi. Extensive computational experiments on public transit systems in major cities in the US and the world are carried out, using real data. Insights gained from real-world case studies are also explained through theoretical analysis.