datetime2 package and LuaTeX timezone interoperability: declaring a fixed compilation zone
0 reputation · 29 Oct 2021, 12:42 UTC
The goal is to produce reproducible, timezone-aware date output from a single source file regardless of where the document is compiled. The datetime2 package formats dates using the engine's local-time primitives (\year, \month, \day, \time), so its useregional option still yields different printed dates when the same source is built on servers in different zones. LuaTeX exposes os.date and os.time with optional tz arguments via the luatz library, enabling true timezone-aware calculations inside \directlua, but datetime2 does not consume this capability. pdfTeX and XeTeX lack any built-in timezone API, forcing reliance on shell-escape to external tools—a non-portable approach that is often disabled in restricted environments. No standard TeX mechanism exists to declare or lock the intended compilation timezone, leaving reproducibility dependent on external environment control (TZ variable, container configuration).
Can datetime2 be extended to accept an explicit timezone identifier that LuaTeX resolves via luatz while falling back to a portable strategy for pdfTeX/XeTeX? What is the minimal interface a TeX engine must provide so that a locale-aware formatting package can perform timezone conversion without shell-escape? Should a new primitive or Lua callback be standardized to let the source declare its intended compilation zone?