I got a question regarding the usage of the datetime2 package. I want to set some due date and to define a certain date such as \paperdate which is either \today when it's before the due date or the due date itself. I tried this based on an example from the package's documentation:
\documentclass{article}
\usepackage[useregional, calc]{datetime2}
\begin{document}
\DTMsavedate{duedate}{2023-04-30}
\DTMifdate
{\today}
{at most=
\DTMfetchyear{duedate}-\DTMfetchmonth{duedate}-\DTMfetchday{duedate}}
{\newcommand\paperdate{\today}}{\newcommand\paperdate{\DTMusedate{duedate}}}
\end{document}
However, this code gives me the following error:
Package datetime2-calc Error: Unknown date `2023-04-23'.
Would anyone know a workaround? Thanks in advance for your help!