Used modules and their versions (System - About): doc, grafana, monitoring
Web browser used: Firefox 96.0.3
Icinga 2 version used (icinga2 --version): r2.13.2-1
PHP version used (php --version): 8.1.2
Server operating system and version: Debian sid
How do I change the date format in the web gui?
Specifically, the format in ‘Use Expire Time’ when acknowledging a problem.
I want to use ISO 8601 (the en_DK-locale).
I tried setting this in /etc/default/icinga2, which is the environment file for icinga2.service (systemd). I’ve added en_DK.UTF-8 to /etc/locale.gen and updated locales.
Test with ‘LC_TIME=en_DK.UTF-8 date’: 2022-02-14T16:28:47 CET
So locales seems to work.
From /lib/systemd/system/icinga2.service: EnvironmentFile=/etc/default/icinga2
I restarted icinga2 (and apache2, just to be sure :-).
And reloaded systemd daemons.
So I tried setting LC_TIME in the Apache site config: ‘SetEnv LC_TIME en_DK.UTF-8’
Restarted apache2.
However, the Expire Time is still ‘MM/DD/YYYY HH:MM:SS PM/AM’.
And changing that in Firefox was apparently not possible. After much
digging I found that Mozilla don’t want to use POSIX anymore, instead
somehow following Unicode CLDR. There is also no way to specify the format
in Firefox, only a hint about how to do this in Thunderbird.
Seems I have to live with the annoying US format since I want
to continue to use english as browser language.
Hey there, glad Johannes could help you out - would you mind marking his answer as the solution?
That way others can quickly see that your question has been answered from the list
Generate locales en_DK.UTF-8 and (optionally) se_SV.UTF-8.
Unset all LC_* variables.
Launch firefox with LANG=en_DK.UTF-8.
Go to Settings → General → Language – now you should see:
(turn it on of course).
This gives dd/mm/yyyy format in type=“date” forms.
Optional: now launch firefox with LANG=sv_SE.UTF-8. Date format will change to yyyy-mm-dd (if I started with sv_SE then the configuraion option would not appear; I had to go through en_DK first).
Well, this may sound strange, but I only want swedish time and date. It’s usually a pain to look for problems when most of the answers are in english, searching for swedish answers usually don’t match anything. We’re not that many…
Anyway, I tried setting LANG to en_DK.UTF-8 and LC_TIME to sv_SE.UTF-8
and it seems to work, I finally got ISO-date and time!
(YYYY-MM-DD HH:MM:SS)
That’s an improvement indeed! While the popup calendar still has Swedish months in it, all system dialogs are back in English. Though I slightly miss Avbryt and Spara…