Page 1 of 1
Mix of AM/PM and 24h Time Format
Posted: Thu 10 Dec 2020 7:07 pm
by KarlS
After moving my CumulusMX installation from a Windows 10 laptop to a Raspberry 4 I noticed that on the admin panel there is the 24h time format used on the "Dashboard", the AM/PM format on "Today/Yesterday" and "Records". My locale is en_CA.UTF-8, so the date command displays the time correctly in 24h format. Since the admin panel is only used locally this is no big deal, but I would like to know if it's my poor Linux skills or if there is another reason for this behaviour. (The Windows machine used the 24h format throughout!)
Re: Mix of AM/PM and 24h Time Format
Posted: Thu 10 Dec 2020 7:33 pm
by mcrossley
I'll take a look at the code and see if there is anything wrong, but my Pi is set to EN-UK locale and all the pages display in 24h format....
Re: Mix of AM/PM and 24h Time Format
Posted: Thu 10 Dec 2020 7:50 pm
by rogerthn
mcrossley wrote: ↑Thu 10 Dec 2020 7:33 pm
I'll take a look at the code and see if there is anything wrong, but my Pi is set to EN-UK locale and all the pages display in 24h format....
Like KarlS
Code: Select all
pi@PI4:~/CumulusMX $ locale
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
Re: Mix of AM/PM and 24h Time Format
Posted: Thu 10 Dec 2020 8:15 pm
by mcrossley
Just checked my pi, odd that I have two blanks...
Code: Select all
LANG=en_GB.UTF-8
LANGUAGE=
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=
Re: Mix of AM/PM and 24h Time Format
Posted: Thu 10 Dec 2020 11:45 pm
by mcrossley
As far as I can tell from the code it has always been like that?
The Dashboard explicitly uses a fixed 24 hour format, Today/Yesterday and the Records use whatever is the default date/time format for your locale. The reason why they are different I do not know. Personally I would probably have coded them all to 24hr format as it is more compact and a consistent length, but I know lots of people like their am/pm format - particularly in the USA I think.
Re: Mix of AM/PM and 24h Time Format
Posted: Fri 11 Dec 2020 12:13 am
by KarlS
mcrossley wrote: ↑Thu 10 Dec 2020 11:45 pm
As far as I can tell from the code it has always been like that?
The Dashboard explicitly uses a fixed 24 hour format, Today/Yesterday and the Records use whatever is the default date/time format for your locale. The reason why they are different I do not know. Personally I would probably have coded them all to 24hr format as it is more compact and a consistent length, but I know lots of people like their am/pm format - particularly in the USA I think.
"Today/Yesterday and the Records use
whatever is the default date/time format for your locale". Well, that is the problem. Under Windows the locale is used, under Raspbian it is not. And before you ask: Raspbian and CumulusMX are running on a brand new Pi4, standard installation, fully updated with no other additional programs installed. As I said in my original post, this is no big deal ... I was just wondering.
Re: Mix of AM/PM and 24h Time Format
Posted: Fri 11 Dec 2020 8:54 am
by mcrossley
But you are using en_CA and the default time format for that locale like en_US is 12h am/pm?
Edit: though I see French Canadian uses 24h!
I am using en_GB and the default is 24h and that is what I see on the admin pages.
Re: Mix of AM/PM and 24h Time Format
Posted: Fri 11 Dec 2020 8:30 pm
by rogerthn
Not sure if I dare to change locale on my PI4 since there are more than CumulusMX running there
Below is my tests on a virtual Debian Buster
locale
Code: Select all
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
date
dpkg-reconfigure locales
Selecting en_GB.UTF-8 as default
locale
Code: Select all
LANG=en_GB.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=
date