Typeset year in old-style numbers with biblatex

\DeclareFieldFormat{oldstyle}{\oldstylenums{#1}}

\renewbibmacro*{cite:labeldate+extradate}{%
    \iffieldundef{labelyear}
    {}
    {\printtext[oldstyle]{\printlabeldateextra}}}

or, if you need hyperref

\DeclareFieldFormat{oldstyle}{\bibhyperref{\oldstylenums{#1}}}

enter image description here


The code for date printing in biblatex is a bit ... unusual and scattered around many different places. It evolved quite a bit and the different requirements mean that it has grown quite complex.

The difficulty with the approach in the question is that the extradate label is also printed by the \printlabeldateextra command and so \oldstylenums would also apply to it.

Ultimately, the code that does the date typesetting lives in the .lbx file. If you want to change all years to old style numerals, you should probably attack there.

Unfortunately, the code is not exactly short and sweet.

The code below is taken from english.lbx (ll. 24-51). If you are using other languages, you need to apply a similar redefinition for each language you use.

\documentclass{article}
\usepackage[backend=biber,style=authoryear-comp]{biblatex}

\newcommand*{\bibyearformat}{\oldstylenums}

\DefineBibliographyExtras{english}{%
  \protected\def\mkbibdatelong#1#2#3{%
    \iffieldundef{#2}
      {}
      {\mkbibmonth{\thefield{#2}}%
       \iffieldundef{#3}
         {\iffieldundef{#1}{}{\space}}
         {\nobreakspace}}%
    \iffieldundef{#3}
      {}
      {\stripzeros{\thefield{#3}}%
       \iffieldundef{#1}{}{,\space}}%
     \iffieldbibstring{#1}
       {\bibstring{\thefield{#1}}}
       {\dateeraprintpre{#1}\bibyearformat{\stripzeros{\thefield{#1}}}}}%
  \protected\def\mkbibdateshort#1#2#3{%
    \iffieldundef{#2}
      {}
      {\mkmonthzeros{\thefield{#2}}%
       \iffieldundef{#3}
         {\iffieldundef{#1}{}{/}}
         {/}}%
    \iffieldundef{#3}
      {}
      {\mkdayzeros{\thefield{#3}}%
       \iffieldundef{#1}{}{/}}%
     \iffieldbibstring{#1}
       {\bibstring{\thefield{#1}}}
       {\dateeraprintpre{#1}\bibyearformat{\mkyearzeros{\thefield{#1}}}}}%
  \protected\def\mkbibseasondateshort#1#2{%
    \mkbibseason{\thefield{#2}}%
    \iffieldundef{#1}{}{\space}%
    \dateeraprintpre{#1}\bibyearformat{\mkyearzeros{\thefield{#1}}}}%
  \protected\def\mkbibseasondatelong#1#2{%
    \mkbibseason{\thefield{#2}}%
    \iffieldundef{#1}{}{\space}%
    \dateeraprintpre{#1}\bibyearformat{\mkyearzeros{\thefield{#1}}}}%
}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Thor2009,
  author  = {Thor, Alice Ursula and Smith, John},
  journal = {Some Journal},
  number  = {8},
  pages   = {123--456},
  title   = {A Very Important Paper},
  volume  = {79},
  year    = {2009},
}
@article{Thor2009b,
  author  = {Thor, Alice Ursula and Smith, John},
  journal = {Some Different Journal},
  number  = {8},
  pages   = {123--456},
  title   = {Another Very Important Paper},
  volume  = {79},
  year    = {2009},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
  Hello \textcite{Thor2009,Thor2009b}.

  \printbibliography
\end{document}

All years in old style numerals.

Currently, the code only applies old style nums for years. Months and days are left alone, one would probably change those to old style nums as well.

\newcommand*{\bibdatenumformat}{\oldstylenums}

\DefineBibliographyExtras{english}{%
  \protected\def\mkbibdatelong#1#2#3{%
    \iffieldundef{#2}
      {}
      {\mkbibmonth{\thefield{#2}}%
       \iffieldundef{#3}
         {\iffieldundef{#1}{}{\space}}
         {\nobreakspace}}%
    \iffieldundef{#3}
      {}
      {\bibdatenumformat{\stripzeros{\thefield{#3}}}%
       \iffieldundef{#1}{}{,\space}}%
     \iffieldbibstring{#1}
       {\bibstring{\thefield{#1}}}
       {\dateeraprintpre{#1}\bibdatenumformat{\stripzeros{\thefield{#1}}}}}%
  \protected\def\mkbibdateshort#1#2#3{%
    \iffieldundef{#2}
      {}
      {\bibdatenumformat{\mkmonthzeros{\thefield{#2}}}%
       \iffieldundef{#3}
         {\iffieldundef{#1}{}{/}}
         {/}}%
    \iffieldundef{#3}
      {}
      {\bibdatenumformat{\mkdayzeros{\thefield{#3}}}%
       \iffieldundef{#1}{}{/}}%
     \iffieldbibstring{#1}
       {\bibstring{\thefield{#1}}}
       {\dateeraprintpre{#1}\bibdatenumformat{\mkyearzeros{\thefield{#1}}}}}%
  \protected\def\mkbibseasondateshort#1#2{%
    \mkbibseason{\thefield{#2}}%
    \iffieldundef{#1}{}{\space}%
    \dateeraprintpre{#1}\bibdatenumformat{\mkyearzeros{\thefield{#1}}}}%
  \protected\def\mkbibseasondatelong#1#2{%
    \mkbibseason{\thefield{#2}}%
    \iffieldundef{#1}{}{\space}%
    \dateeraprintpre{#1}\bibdatenumformat{\mkyearzeros{\thefield{#1}}}}%
}

You should adjust the field format for date etc. via e.g.

\DeclareFieldFormat{date}{\oldstylenums{#1}}

which is where the biblatex documentation says changes to fonts for individual fields belong. Unfortunately there are several fields to set to get this right. If have missed some please let me know.

Sample output

\begin{filecontents}{\jobname.bib}
@article{Thor2009,
    author  = {Thor, Alice Ursula and Smith, John},
    journal = {Some Journal},
    number  = {8},
    pages   = {123--456},
    title   = {A Very Important Paper},
    volume  = {79},
    year    = {2009}
}

@article{Thor2009b,
    author  = {Thor, Alice Ursula and Smith, John},
    journal = {Some Different Journal},
    number  = {8},
    pages   = {123--456},
    title   = {Another Very Important Paper},
    volume  = {79},
    year    = {2009}
}
\end{filecontents}

\documentclass{article}
\usepackage[backend=biber,style=authoryear-comp]{biblatex}

\addbibresource{\jobname.bib}

\DeclareFieldFormat{date}{\oldstylenums{#1}}
\DeclareFieldFormat{dateextra}{\oldstylenums{#1}}
\DeclareFieldFormat{extradate}{\oldstylenums{\mknumalph{#1}}}
\DeclareFieldFormat{labeldate}{\oldstylenums{#1}}
\DeclareFieldFormat{labeldateextra}{\oldstylenums{#1}}

\begin{document}

Hello \textcite{Thor2009,Thor2009b}.

\printbibliography

\end{document}

Tags:

Biblatex