Template:LocaleDate
This template was an experiment in using template CSS via the TemplateStyles extension to dynamically reformat dates as mdy or dmy based on the user's locale*. This hacky attempt failed because the sanitizer used by TemplateStyles to safety-check the CSS does not allow CSS variables. Amazingly MediaWiki still lacks the ability for a template to directly read the user's locale.
*The locale would need to be read via JavaScript, which would then set some CSS variables accordingly. The JS code was never written, but it would look something like:
function getLang() { if (navigator.languages !== undefined) return navigator.languages[0]; return navigator.language; } const lang = getLang(); const root = document.querySelector(':root'); if (lang == "en-US") { root.style.setProperty('--month-order', '1'); root.style.setProperty('--day-order', '2'); } else { root.style.setProperty('--month-order', '2'); root.style.setProperty('--day-order', '1'); }