Previous studies of the stellar mean metallicity and [Mg/Fe] values of massive elliptical (E) galaxies suggest that their stars were formed over a very short timescale that cannot be reconciled with estimates from stellar population synthesis (SPS) studies and with hierarchical assembly. Applying the previously developed chemical evolution code, GalIMF, which allows an environment-dependent stellar initial mass function (IMF) to be applied to the integrated galaxy initial mass function theory instead of an invariant canonical IMF, the star formation timescales (SFT) of E galaxies are re-evaluated. The code’s uniqueness lies in it allowing the galaxy-wide IMF and associated chemical enrichment to evolve as the physical conditions in the galaxy change. The calculated SFTs become consistent with the independent SPS results if the number of type Ia supernovae (SNIa) per unit stellar mass increases for more massive E galaxies. This is a natural outcome of galaxies with higher star formation rates producing more massive star clusters, spawning a larger number of SNIa progenitors per star. The calculations show E galaxies with a stellar mass ≈109.5 M⊙ to have had the longest mean SFTs of ≈2 Gyr. The bulk of more massive E galaxies were formed faster (SFT ≈ 1 Gyr) leading to domination by M dwarf stars and larger dynamical mass-to-light ratios as observed, while lower mass galaxies tend to lose their gas supply more easily due to their shallower potential and therefore also have similarly-short mean SFTs. This work achieves, for the first time, consistency of the SFTs for early-type galaxies between chemical-enrichment and SPS modelling. Equally, it leads to an improved understanding of how the star formation environment may affect the total number of SNIa per unit stellar mass formed.