[Tex/LaTex] Date format (in bib entry) / bibelatex biber

biberbiblatexdate

I'm using biber and biblatex and I wanna print all thesis prior to 2013. When I use

year = {2010}

entry in the .bib file, every think works fine. However, if I use

date = {2010-11-25}

instead of year, my entry is ignored. I'm respecting the date format, right?
So what is wrong? Here is a MWE.

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@THESIS{a,
  AUTHOR =  {Myself},
  TITLE = {Me, myself and I},
  Institution = {My University},
  type = {Ph.D. thesis},
  year = {2010} 

} %  date = {2010-11-25}
\end{filecontents*}
\usepackage[backend=biber,defernumbers=true,sorting=ydnt]{biblatex}
\addbibresource{\jobname.bib}
\DeclareSourcemap{
  \maps[datatype=bibtex]{
         \map[overwrite=true]{
            \step[fieldsource=year,  match=\regexp{199([7-9])|200([0-9])|201([0-2])},final]
            \step[fieldset=keywords, fieldvalue={,}, append]
        \step[fieldset=keywords, fieldvalue={before2013}, append]
}}}

\begin{document}
Hello world.
    \nocite{*}
    \printbibliography[type=thesis,keyword=before2013,title=Thesis,resetnumbers=true]
\end{document}

Best Answer

Instead of Biber's sourcemapping you can compare the year field with biblatex in the document. (We can use year here regardless of whether you used year or date since a date field is always split up into its components when it is written to the .bbl.)

We define a bibcheck

\defbibcheck{before2013}{%
  \iffieldint{year}
    {\ifnumless{\thefield{year}}{2013}
       {}
       {\skipentry}}
    {\skipentry}}

and use that check instead of the keyword

\printbibliography[type=thesis,check=before2013,title=Thesis,resetnumbers=true]
Related Question