ABSTRACT The evolution of circumstellar discs is influenced by their surroundings. The relevant processes include external photoevaporation due to nearby stars and dynamical truncations. The impact of these processes on disc populations depends on the star-formation history and on the dynamical evolution of the region. Since star-formation history and the phase-space characteristics of the stars are important for the evolution of the discs, we start simulating the evolution of the star cluster with the results of molecular cloud collapse simulations. In the simulation, we form stars with circumstellar discs, which can be affected by different processes. Our models account for the viscous evolution of the discs, internal and external photoevaporation of gas, external photoevaporation of dust, and dynamical truncations. All these processes are resolved together with the dynamical evolution of the cluster, and the evolution of the stars. An extended period of star formation, lasting for at least 2 Myr, results in some discs being formed late. These late-formed discs have a better chance of survival because the cluster gradually expands with time, and a lower local stellar density reduces the effects of photoevaporation and dynamical truncation. Late formed discs can then be present in regions of high UV radiation, solving the proplyd lifetime problem. We also find a considerable fraction of discs that lose their gas content but remain sufficiently rich in solids to be able to form a rocky planetary system.