On the metallicity dependence of the [Y/Mg]–age relation for solar-type stars