# Remove “n.d.” (no date) from online entries without dates in biblatex

biblatex prints the string n.d. (no date) in the bibliography for entries that have no date information in the .bib file (as a result of this question).

It didn't use to print n.d. for @online entries, but in the current version (3.6) it does. My question is, how can I remove all such n.d./nodate strings from all @online entries, while leaving others alone (as in @book in the example below, which should still print n.d.)?

\documentclass{article}
\usepackage[style=authoryear-comp]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{lennon,
AUTHOR = "John Lennon",
TITLE = "Who did what in the Beatles"}
\end{filecontents}

\begin{document}
\printbibliography
\end{document}


The answer was updated with a much better solution. See the edit history for the earlier, less elegant approach.

The "nodate" marker is inserted by the labeldate format as fall-back with \literal{nodate} at the very end of \DeclareLabeldate. We can suppress this for @online entries by providing a type-sepcific definition for \DeclareLabeldate. With the code below the labeldate field will simply come out undefined instead of "nodate" if no suitable date fields are defined for @online entries.

\documentclass{article}
\usepackage[style=authoryear-comp]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{lennon,
AUTHOR = "John Lennon",
TITLE = "Who did what in the Beatles"}
\end{filecontents}

\DeclareLabeldate[online]{%
\field{date}
\field{year}
\field{eventdate}
\field{origdate}
\field{urldate}
}

\begin{document}
\printbibliography
\end{document}


gives