[Tex/LaTex] Custom format for biblatex eventdate with day range

biblatexdatetime

How can I specify a custom date format in biblatex for eventdate in case a range of several days or weeks is specified?

Using \thefield{eventday} for example only returns the first day of the range, but not the last. I tried it that way:

\documentclass{article}

\usepackage[style=numeric,backend=biber]{biblatex}

\DeclareFieldFormat{eventdate}{%
  \thefield{eventyear}%
  \space
  \mkbibmonth{\thefield{eventmonth}}%
  \space%
  \thefield{eventday}}

\begin{filecontents*}{database.bib}
@inproceedings{Baker2011,
 author = {Baker, Christopher R. and Dolan, John M. and Wang, Shige and Litkouhi, Bakhtiar B.},
 bookpagination = {page},
 booktitle = {2011 IEEE Int. Conf. Robotics and Automation},
 doi = {10.1109/ICRA.2011.5980355},
 eventdate = {2011-05-09/2011-05-13},
 eventtitle = {2011 IEEE International Conference on Robotics and Automation (ICRA 2011)},
 isbn = {978-1-61284-386-5},
 keywords = {software architecture},
 pages = {6071--6077},
 publisher = {IEEE},
 location = {Piscataway, NJ},
 title = {Toward adaptation and reuse of advanced robotic software},
 venue = {Shanghai, China},
 year = {2011}
}
\end{filecontents*}
\bibliography{database}

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

\end{document}

What I need is an event date in the format 2010 Aug 10-12.

Best Answer

Try the following redefinition of date internals (note that you will have to wrap it in \DefineBibliographyExtras{<doclang>}). This changes the setting for comp dates. So it will alter more than just your eventdates. Most dates are comp by default, notable exceptions being labeldate=year and urldate=short.

\documentclass{article}
\usepackage[style=numeric,backend=biber]{biblatex}

\makeatletter
\DefineBibliographyExtras{english}{%
  \protected\def\mkbibdatelong#1#2#3{%
    \iffieldbibstring{#1}
      {\bibstring{\thefield{#1}}}
      {\dateeraprintpre{#1}\stripzeros{\thefield{#1}}}%
    \iffieldundef{#2}
      {}
      {\iffieldundef{#1}{}{\space}%
        \mkbibmonth{\thefield{#2}}%
        \iffieldundef{#3}{}{\space}}%
    \iffieldundef{#3}
      {}
      {\stripzeros{\thefield{#3}}}}%
%
\protected\gdef\lbx@us@mkdaterangetrunc@long#1#2{%
  \begingroup
    \blx@metadateinfo{#2}%
    \iffieldundef{#2year}
      {\blx@nounit}
      {\printtext[#2date]{%
         \datecircaprint
         \iffieldundef{#2season}
           {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}}
           {\csuse{mkbibseasondate#1}{#2year}{#2season}}%
         \dateeraprint{#2}%
         \dateuncertainprint
         \iffieldundef{#2endyear}
           {}
           {\iffieldequalstr{#2endyear}{}
             {\mbox{\bibdaterangesep}}
             {\bibdaterangesep
              \enddatecircaprint
              \iffieldundef{#2season}
                {\iffieldsequal{#2year}{#2endyear}
                  {\iffieldsequal{#2month}{#2endmonth}
                    {\csuse{mkbibdate#1}{}{}{#2endday}}
                    {\csuse{mkbibdate#1}{}{#2endmonth}{#2endday}}}
                  {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}}
                {\csuse{mkbibseasondate#1}{#2endyear}{#2endseason}}%
              \enddateuncertainprint
              \dateeraprint{#2}}}}}%
  \endgroup}%
}
\makeatother

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@inproceedings{Baker2011,
  author         = {Baker, Christopher R. and Dolan, John M. and Wang, Shige and Litkouhi, Bakhtiar B.},
  bookpagination = {page},
  booktitle      = {2011 IEEE Int. Conf. Robotics and Automation},
  doi            = {10.1109/ICRA.2011.5980355},
  eventdate      = {2011-05-09/2011-05-13},
  eventtitle     = {2011 IEEE International Conference on Robotics and Automation (ICRA 2011)},
  isbn           = {978-1-61284-386-5},
  keywords       = {software architecture},
  pages          = {6071--6077},
  publisher      = {IEEE},
  location       = {Piscataway, NJ},
  title          = {Toward adaptation and reuse of advanced robotic software},
  venue          = {Shanghai, China},
  year           = {2011},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

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