Electric-field gradients (EFG's) in yttrium trideuteride $({\mathrm{YD}}_{2.98})$ have been determined using deuteron magnetic resonance (DMR) and compared with values for the $P3\ifmmode\bar\else\textasciimacron\fi{}c1$ and ${P6}_{3}\mathrm{cm}$ structures calculated from first principles. The experimental DMR spectra at low temperatures (180--290 K) could be decomposed into two components with intensity ratio $2:1$ in accordance with the expected two groups of deuterium sites, i.e., tetrahedral and octahedral sites in the crystal lattice. Their characteristic quadrupole frequencies, ${\ensuremath{\nu}}_{q},$ and asymmetry parameters, \ensuremath{\eta}, have been compared with the theoretical values obtained for the structures with space groups $P3\ifmmode\bar\else\textasciimacron\fi{}c1$ (no. 165) and ${P6}_{3}\mathrm{cm}$ (no. 185). The agreement between the experimental and calculated results is much better for the latter structure. The spectra at higher temperatures (300--370 K) transform from a two-component configuration into three quadrupolar doublets plus a low-intensity narrow central component. One of the doublets keeps the same parameters as those observed at low temperatures. The two others indicate changes in the tetrahedral site environments. One possible explanation could be a thermally activated quasi-two-dimensional hopping of the D atoms to nearby sites within the $\mathrm{ab}$ plane.