# datetime2 does not respect polyglossia language settings (using lualatex)

datetime2 does not automatically deduces the correct language from the polyglossia settings. If you set the date style by hand, it works. (datetime2-german is installed.)

I'm using lualatex (this might be relevant):

\$ lualatex --version
This is LuaTeX, Version 1.0.4 (TeX Live 2017)


MWE:

\documentclass{scrartcl}

\usepackage{polyglossia}
\setdefaultlanguage{german}
\usepackage{datetime2}

\begin{document}
\today

\DTMsetdatestyle{german}
\today
\end{document}


with output

The datetime2 docu reads:

If you want to use datetime2 with babel or polyglossia, make sure you load babel/ polyglossia before you load datetime2 otherwise their \date〈language〉 will overwrite \datetime’s definition of \today. Additionally you need to make sure you install the relevant datetime2 language modules.

Thanks for your help and any ideas!

• Have you tried \usepackage[useregional]{datetime2}? – Nicola Talbot Apr 12 '18 at 10:44
• Indeed, that works. Can you explain why this is necessary? Did I just missed this in the documentation? (Thanks for the nice package btw!) – ccauet Apr 12 '18 at 10:48
• (Thanks!) Yes, it is documented :-) The default is to use the non-locale style. (Chapter 6, two paragraphs down from your quote: "By default useregional is false, unless the language/ region is passed via the datetime2 package option list. ") – Nicola Talbot Apr 12 '18 at 10:55

The default behaviour of datetime2 is to use the numeric ISO style regardless of the document language. You can switch on the locale-sensitive date and time using one of the following methods:
• Use the package option useregional (or useregional=text) for textual dates and useregional=numeric (or useregional=num) for the locale-sensitive numeric style.
• Declare the locales in datetime2's package option list. For example \usepackage[de-DE-1996]{datetime2}. (This is useful if the document language setting doesn't include the required region but the relevant datetime2 language module supports it. For example, \usepackage[en-IE]{datetime2}, which uses GMT/IST time zones or \usepackage[en-GG]{datetime2}, which uses CET/CEST time zones.)