The public sources for my resume. These sources are auto compiled and published upon changes.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

86 lines
2.1 KiB

\newcounter{datetoday}
\newcounter{diffyears}
\newcounter{diffmonths}
\newcounter{diffdays}
% Function curtesy of Martin Scharrer
% http://tex.stackexchange.com/questions/14518/difference-between-two-dates
\newcommand{\difftoday}[3]{%
\setmydatenumber{datetoday}{\the\year}{\the\month}{\the\day}%
\setmydatenumber{diffdays}{#1}{#2}{#3}%
\addtocounter{diffdays}{-\thedatetoday}%
\ifnum\value{diffdays}>0
\def\diffbefore{in }%
\def\diffafter{}%
\else
\def\diffbefore{}%
\def\diffafter{}%
\setcounter{diffdays}{-\value{diffdays}}%
\fi
\setcounter{diffyears}{\value{diffdays}/365}%
\setcounter{diffdays}{\value{diffdays}-365*\value{diffyears}}%
\setcounter{diffmonths}{\value{diffdays}/30}%
\setcounter{diffdays}{\value{diffdays}-30*\value{diffmonths}}%
%
\diffbefore
\ifnum\value{diffyears}=0
\else
\ifnum\value{diffyears}>1
\thediffyears\space years\ignorespacesafterend
\else
\thediffyears\space year\ignorespacesafterend
\fi
\fi
\ifnum\value{diffmonths}=0
\else
\ifnum\value{diffyears}>0
,
\fi
\ifnum\value{diffmonths}>1
\thediffmonths\space months\ignorespacesafterend
\else
\thediffmonths\space month\ignorespacesafterend
\fi
\fi
\diffafter
}
\newcommand{\diffdates}[6]{%
\setmydatenumber{datetoday}{#4}{#5}{#6}%
\setmydatenumber{diffdays}{#1}{#2}{#3}%
\addtocounter{diffdays}{-\thedatetoday}%
\ifnum\value{diffdays}>0
\def\diffbefore{in }%
\def\diffafter{}%
\else
\def\diffbefore{}%
\def\diffafter{}%
\setcounter{diffdays}{-\value{diffdays}}%
\fi
\setcounter{diffyears}{\value{diffdays}/365}%
\setcounter{diffdays}{\value{diffdays}-365*\value{diffyears}}%
\setcounter{diffmonths}{\value{diffdays}/30}%
\setcounter{diffdays}{\value{diffdays}-30*\value{diffmonths}}%
%
\diffbefore
\ifnum\value{diffyears}=0
\else
\ifnum\value{diffyears}>1
\thediffyears\space years\ignorespacesafterend
\else
\thediffyears\space year\ignorespacesafterend
\fi
\fi
\ifnum\value{diffmonths}=0
\else
\ifnum\value{diffyears}>0
,
\fi
\ifnum\value{diffmonths}>1
\thediffmonths\space months\ignorespacesafterend
\else
\thediffmonths\space month\ignorespacesafterend
\fi
\fi
\diffafter
}