I'm writing a document class that uses the datetime2 package to write a month-year date in the title of the document. Here is a MWE:
\begin{filecontents}[overwrite]{customclass.cls}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{customclass}[2014/12/16 Custom class]
\LoadClassWithOptions{article}
\RequirePackage{babel}
\RequirePackage[useregional]{datetime2}
\DTMlangsetup*{showdayofmonth=false}
\renewcommand{\maketitle}[0]{\today}
\end{filecontents}
\documentclass[<language>]{customclass}
\begin{document}
\maketitle
\end{document}
I have run into the problem that many languages don't capitalize month names, whereas the desired behavior would be to capitalize them since it is a title (e.g. "Marzo de 2022" instead of "marzo de 2022").
I have tried using \expandafter\MakeUppercase and also the mfirstuc package as explained here, but none of those work (I assume it's because the \today command is pretty complex so it's not easy to expand?). I also cannot hard-code month names because I expect this class to work independently of language, and because I regularly use four languages to typeset documents (French, Italian, Spanish and English, three of which display this issue).
I would love a bit of help with this!



\DTMitalianmonthnameis defined 2 times in the code (line 5 page 1 and line 99 page 4). But for spanish (http://mirrors.ctan.org/macros/latex/contrib/datetime2-contrib/datetime2-spanish/datetime2-spanish.pdf) we have\DTMspanishmonthnameline 5 page 2 and\DTMspanishMonthnameline 33 page 2 (the former lowercase, the latter uppercase). Will file a bug report. – quark67 Mar 23 '23 at 01:34\iflanguagecommand from babel). – quark67 Mar 23 '23 at 02:50\todaywith\DTMlangsetup*{showdayofmonth=false}is for english: "March 23, 2023" (why the day ???) and for hungarian: "március 2023", not "2023. március". It's probably better to ask a new question (forgetting the uppercase problem) about how to obtain the good string with only month and year (and "de" when needed). Then for the uppercase: stringstrings and \capitalize{\today} adds space for spanish (Marzo de 2023insteadMarzo de 2023), but there is a solution with xstring. – quark67 Mar 23 '23 at 16:35\DTMlangsetup*{showdayofmonth=false}is the warning-suppressed version of\DTMlangsetup{showdayofmonth=false}, which indeed warns that english datetime does not supportshowdayofmonth=false(which is weird, because bothbritishandamericansupport it). I agree that this question has opened up a bunch of edge cases and has highlighted some bugs that I didn't think of originally. I'm not sure there currently is a way of doing what I'm looking for without writing a separate package, but lmk if you find anything! I'm going to leave this marked as solution for now. – Pedro Mar 23 '23 at 16:52