[Tex/LaTex] Center date in beamer footline when reducing font size

beamerheader-footerthemes

Consider the following MWE:

\documentclass[10pt]{beamer}

\usepackage{lmodern}
\usetheme{Madrid}

\title{Testing Beamer Title}
\subtitle{With 10pt font}
\author{John Doe}
\date{\today}

\begin{document}
\frame{\titlepage}
\end{document}

As you can see in the first image, the date in the third part of the footer is not properly centered (for instance it is not as centered as the second image where I didn't set the 10pt option). So my question is: how do I center the date in the third part/section of the footer while keeping the frame number to the far right?

enter image description here
enter image description here

Edit: The answer provided by Kevin C works great. However I was wondering if instead of redefining the whole footline one could only patch the lines corresponding to date in head/foot with etoolbox like it is done in this answer.

Best Answer

The default footline theme with Madrid has the last block right-aligned. Thus the date there is not centered and will be slightly shifted when page numbers change (e.g. when going from single digit to double digits).

To have the the date centered in the last block and unaffected by the changes in the page count, one may define a new footline theme as in the following MWE:

MWE

\documentclass[]{beamer}

\usepackage{etoolbox}
\usepackage{lmodern}
\usetheme{Madrid}

\makeatletter
% change in-box alignment from right to left
\patchcmd{\beamer@@tmpl@footline}% <cmd>
  {right}% <search>
  {left}% <replace>
  {}% <success>
  {}% <failure>

% replace definition of 'date in head/foot' box
\patchcmd{\beamer@@tmpl@footline}% <cmd>
  {\usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
   \insertframenumber{} / \inserttotalframenumber\hspace*{2ex}}% <search>
  {\rlap{\makebox[.333333\paperwidth][r]{\insertframenumber{} / \inserttotalframenumber \hspace*{2ex}}}
   \usebeamerfont{date in head/foot}\hfill\insertshortdate{}\hfill}% <replace>
  {}% <success>
  {}% <failure>
\makeatother

\title{Testing Beamer Title}
\subtitle{With default font size}
\author{John Doe}
\date{\today}

\begin{document}
\frame{\titlepage}
\frame{test}\frame{test}\frame{test}\frame{test}\frame{test}
\frame{test}\frame{test}\frame{test}\frame{test}\frame{test}
\end{document}

Output

enter image description here