Context. In the context of the IRAM 30 m Large Program Gas phase Elemental abundances in Molecular CloudS (GEMS), we present a study of thioformaldehyde (H2CS) and its deuterated versions (HDCS and D2CS) in several starless cores located in a selected set of star-forming filaments of Taurus, Perseus, and Orion. These regions have different star formation activities and, therefore, distinct physical and chemical conditions. Aims. Our goal is to investigate the influence of the environmental conditions on the abundances of these molecules in the cores, as well as the effect of time evolution. Methods. We have modelled the observed lines of H2CS, HDCS, and D2CS using the radiative transfer code RADEX. We have also used the chemical code Nautilus to model the evolution of these species depending on the characteristics of the starless cores. Results. We derive column densities and abundances for all the cores. We also derive deuterium fractionation ratios, Dfrac, which allow us to determine and compare the evolutionary stage between different parts of each star-forming region. Our results indicate that the north region of the B 213 filament in Taurus is more evolved than the south, while the north-eastern part of Perseus presents an earlier evolutionary stage than the south-western zone. Model results also show that Dfrac decreases with the cosmic-ray ionisation rate, while it increases with density and with the degree of sulphur depletion. In particular, we can only reproduce the observations when the initial sulphur depletion in the starless cores is at least one order of magnitude lower than the solar elemental sulphur abundance. Conclusions. The progressive increase in HDCS/H2CS and D2CS/H2CS with time makes these ratios powerful tools for deriving the chemical evolutionary stage of starless cores. However, they cannot be used to derive the temperature of these regions, since both ratios present a similar evolution at two different temperature ranges (~7–11 K and ~ 15–19 K). Regarding chemistry, (deuterated) thioformaldehyde is mainly formed through gas-phase reactions (double-replacement and neutral-neutral displacement reactions), while surface chemistry plays an important role as a destruction mechanism.