Menu

#66 When using scrlttr2 class with package datetime2 option numericaldate does not work

KOMA-Script 3.42
closed
scrlttr2 (15)
2024-04-10
2024-04-10
Markus Kohm
No

When using scrlttr2 with option numericaldate to get a numerical date instead of a symbolic date at the notepaper and also using package datetime2 to be able to use, e.g., \DTMtoday to get a date with month name, the automatically printed date at the notepaper is also with month name instead of numerical:

\documentclass[12pt,a4paper,ngerman,numericaldate]{scrlttr2}

\usepackage{babel}
\usepackage[useregional]{datetime2}

\begin{document}
\begin{letter}{
      An\\
      alle Interessenten\\
      00000 Hier
    }

    \opening{Hi,}

   das aktuelle Datum ist \DTMtoday

    \closing{Mit freundlichen Grüßen}

\end{letter}

\end{document}

Discussion

  • Markus Kohm

    Markus Kohm - 2024-04-10
    • status: open --> closed
     
  • Markus Kohm

    Markus Kohm - 2024-04-10

    This is not a bug of KOMA-Script. It is a kind of feature of package datetime2. The package explicitly uses

    \@ifclassloaded{scrlttr2}{\AtBeginDocument{\let\today\DTMtoday}}{}
    

    to overwrite scrlttr2 option numericaldate. IMHO it would be better, if datetime2 would not do this, but this is an acceptable design decision of the datetime2 author.

    As a workaround you can use:

    \documentclass[12pt,a4paper,ngerman,numericaldate]{scrlttr2}
    
    \usepackage{babel}
    \usepackage[useregional]{datetime2}
    \AtBeginDocument{\expandafter\selectlanguage\expandafter{\languagename}}
    \begin{document}
    \begin{letter}{
          An\\
          alle Interessenten\\
          00000 Hier
        }
    
        \opening{Hi,}
    
        das aktuelle Datum ist \DTMtoday
    
        \closing{Mit freundlichen Grüßen}
    
    \end{letter}
    
    \end{document}
    

    As an alternative see the datetime2 manual about configure datetime2 to show the numerical date (and later reconfigure it to again show the textual date).

    From [r4107] you can alternatively use class scrletter or another class with package scrletter. For those datetime2 does not break option numericaldate. But before with versions before [r4107] this would not work because of bug [#65].

     

    Related

    Commit: [r4107]
    Issues: #65


    Last edit: Markus Kohm 2024-04-10

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.