Put year into parentheses using biblatex-chicago

I want to use the biblatex-chicago style and want to put the year into parentheses.

Therefore I followed the solution from this post: parenthesis around year

However, it seems that this just works for biblatex without chicago style. Using the chicago style the parentheses are added at the end of the reference with no content.

Here is a MWE:

\begin{filecontents*}{test.bib}
@INPROCEEDINGS{author2017,
author = {Firstname Lastname},
title = {My Title},
year = {2017},
pages = {123--124}
}
\end{filecontents*}

\documentclass{scrbook}
\usepackage[
authordate,
backend=biber,
]{biblatex-chicago}

% Try to add parentheses around year in bibliography
% however, they are added at the end
\DeclareFieldFormat{parens}{\mkbibparens{#1}}
\renewbibmacro*{date}{\printtext[parens]{\printdate}}

\bibliography{test.bib}

\begin{document}
\textcite{author2017}
\printbibliography
\end{document}


Extended MWE with article and solution from moewe:

\begin{filecontents*}{\jobname.bib}
@INPROCEEDINGS{author2017inp,
author = {Firstname Lastname},
title = {My In Proceedings},
year = {2017},
pages = {123--124}
}
@ARTICLE{author2017art,
author = {Firstname Lastname},
title = {My Article},
year = {2017},
pages = {123--124}
}
@BOOK{author2017book,
author = {Firstname Lastname},
title = {My Book},
year = {2017},
pages = {123--124}
}

\end{filecontents*}

\documentclass{article}
\usepackage[
authordate,
backend=biber,
]{biblatex-chicago}

\makeatletter
\renewbibmacro*{cmsbibyear}{%
\printtext[parens]{%
\iftoggle{cms@origlabel}%
{\usebibmacro{origyear+labelyear}}%
{\iftoggle{cms@bothlabelnew}%
{\usebibmacro{bothyear+oldstyle}}%
{\iftoggle{cms@bothlabelold}%
{\usebibmacro{bothyear+oldstyle}}%
{\usebibmacro{labelyear+extrayear}}}}}%
\ifcsdef{@cms@tempdate}%
{\toggletrue{\@cms@tempdate}}%
{}}%
\makeatother

\begin{document}
\nocite{*}
\printbibliography
\end{document}

• Welcome to TeX.se, and thanks for posting a perfect minimal example document. The year processing in biblatex-chicago is very complex because it manages both original year and publication year formatting, along with year ranges for e.g. video types. So the solution will not be as simple, unfortunately. Apr 13 '17 at 0:33

biblatex-chicago's date handling is very complicated to make sure it conforms to CMS standards, so it is not at all easy to change that. The following seems to be the safest and shortest redefinition - in very few cases it could lead to undesirable results though, but I have yet to come across one of those cases.

\begin{filecontents*}{\jobname.bib}
@INPROCEEDINGS{author2017,
author = {Firstname Lastname},
title = {My Title},
year = {2017},
pages = {123--124}
}
\end{filecontents*}

\documentclass{article}
\usepackage[
authordate,
backend=biber,
]{biblatex-chicago}

\makeatletter
\renewbibmacro*{cmsbibyear}{%
\printtext[parens]{%
\iftoggle{cms@origlabel}%
{\usebibmacro{origyear+labelyear}}%
{\iftoggle{cms@bothlabelnew}%
{\usebibmacro{bothyear+oldstyle}}%
{\iftoggle{cms@bothlabelold}%
{\usebibmacro{bothyear+oldstyle}}%
{\usebibmacro{labelyear+extrayear}}}}}%
\ifcsdef{@cms@tempdate}%
{\toggletrue{\@cms@tempdate}}%
{}}%
\makeatother

\begin{document}
\textcite{author2017}
\printbibliography
\end{document}


• Many thanks for this idea. Basically it works! Unfortunately, I found a first unwanted behavior: Citing articles leads to having the year attached to the reference. See the extended MWE in my first post. Apr 13 '17 at 14:01
• @Kevin Ah, we introduced a new group which keeps the many \clearfield{year} in the macros local. Add \clearfield{year}% to the end of the macro definition. Apr 13 '17 at 14:12