Changing date format?

  • Icinga Web 2 version: 2.9.5-1.bullseye
  • 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’.

What did I do wrong? :slight_smile:

The format shown in the datetime inputs cannot be influenced by Icinga Web 2. The browser in question is responsible for the shown format.

1 Like

I see.

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.

Anyway, thanks for answering!

1 Like

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 :slight_smile:

Try this:

  1. Generate locales en_DK.UTF-8 and (optionally) se_SV.UTF-8.
  2. Unset all LC_* variables.
  3. Launch firefox with LANG=en_DK.UTF-8.
  4. Go to Settings → General → Language – now you should see:

Screenshot_2022-02-18_20-57-12

(turn it on of course).

This gives dd/mm/yyyy format in type=“date” forms.

  1. 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).

In thunderbird it’s sufficient to set LC_TIME :grinning:

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… :slight_smile:

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)

Thanks!

1 Like

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…