# Biblatex and entries with no date

I have a bibliographic entry with no date. I would like this to be printed both in the citation (i.e. in the text) and in the references with "n.d.", otherwise it shouldn't be different from a regular entry.

In the example below, I would like the citations to be

Lennon (n.d.); Lennon (1972)

and the references to be

Lennon, John (n.d.). Peace on earth.

Lennon, John (1972). More peace on earth.

\documentclass{article}
\usepackage{csquotes,filecontents}
\usepackage[style=authoryear,dashed=false]{biblatex}
\begin{filecontents}{\jobname.bib}
@BOOK{lennon,
AUTHOR = "John Lennon",
TITLE = "Peace on earth"}
@BOOK{lennon1972,
AUTHOR = "John Lennon",
TITLE = "More peace on earth",
YEAR = "1972"}
\end{filecontents}
\begin{document}
\textcites{lennon}{lennon1972}.
\printbibliography
\end{document}


-

\newcommand{\mkbibnodate}{n\adddot d\adddot}
\AtEveryCitekey{\iffieldundef{labelyear}{\restorefield{labelyear}{\mkbibnodate}}{}}
\AtEveryBibitem{\iffieldundef{labelyear}{\restorefield{year}{\mkbibnodate}}{}}


With biber, you can achieve the same result with the source map:

\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite=false]{
\step[fieldset=date,origfieldval,final]
\step[fieldset=eventdate,origfieldval,final]
\step[fieldset=origdate,origfieldval,final]
\step[fieldset=urldate,origfieldval,final]
\step[fieldset=eventyear,origfieldval,final]
\step[fieldset=origyear,origfieldval,final]
\step[fieldset=urlyear,origfieldval,final]
\step[fieldset=year,fieldvalue={n.d.},final]
\step[fieldset=sortyear,fieldvalue={0000}]
}
}
}


Both of these approaches are style-independent so they should work for authoryear and any of its variants.

The above sourcemap is based on the default labelyear specification:

\DeclareLabelyear{
\field{year}
\field{eventyear}
\field{origyear}
\field{urlyear}
}


Currently \DeclareLabelyear does not support literal strings, but something like the following would be useful:

\DeclareLabelyear{
\field{year}
\field{eventyear}
\field{origyear}
\field{urlyear}
\literal{n.d.}
}


I've added a feature request for this at the biblatex github repository.

-
A follow-up note: Using the former alternative, biblatex now also adds n.d. to the entry type @ONLINE, which is not suitable, since the @ONLINE entry has a field URLDATE for this purpose. I assume there's an easy fix for this (one that skips @ONLINE entries or one that doesn't add n.d. if the entry has a field for URLDATE), but I wouldn't know how to do it. –  Sverre Mar 7 '13 at 18:43
@Sverre labelyear has a few fallback values if year isn't defined. For the first approach you can just base the test always on labelyear. Accounting for fallbacks in second approach gets messy. –  Audrey Mar 7 '13 at 23:40

Please try biblatex 2.6/biber 1.6 development versions from SourceForge. This set up is now the default and there is a new localisation string "nodate" which defaults to "n.d." in all languages currently. \DeclareLabelyear is now the more general:

\DeclareLabeldate{%
\field{date}
\field{event}
\field{orig}
\field{url}
\literal{nodate}
}


but you shouldn't need to worry about that unless you are a style author using this macro. With these versions, your example gives the following without any extra coding:

Changing the "nodate" localisation string for your language will change the "n.d." in both the references and citation.

-
Good to hear that the next(?) version of biblatex and biber will do this by default. I also hope the appropriate language specific variants will be added in the near future (that is not a pressing need for me). I will myself wait until the next version is released, since I update my packages through TexLive. –  Sverre Mar 14 '13 at 11:40
Most language variants for "nodate" have now been incorporated into the biblatex 2.6 dev version. –  PLK Mar 15 '13 at 12:50
\renewbibmacro*{date+extrayear}{%
\iffieldundef{year}
{\printtext[parens]{n.d.}}
{\printtext[parens]{\printdateextra}}}%

\renewbibmacro*{cite:label}{%
\iffieldundef{label}
{\printtext[bibhyperref]{\printtext{n.d.}}}
{\printtext[bibhyperref]{\printfield{label}}}}

-
While this works for \textcite, it doesn't work with \cite or \parencite. In the latter two cases, it only prints n.d., and not the author's name. –  Sverre Mar 6 '13 at 16:40