nicorac / bcr-gui

BCR-GUI is a companion app for the great BCR (Basic Call Recorder) Android application and other supported ROMs with embedded call recorders.
https://coolsoft.altervista.org
GNU General Public License v3.0
146 stars 7 forks source link

Support standard date and time formats #17

Closed m-sundman closed 10 months ago

m-sundman commented 11 months ago

Could you please add support for standard ISO date and time formats? That is, yyyy-MM-dd and HH:mm:ss (where HH is 00-23), respectively.

m-sundman commented 10 months ago

Still 0.0.17 has only insane 12h clock (days don't have 12 hours, they have 24 hours) and insane date formats (most other numbers on the planet go from (magnitudally) larger to smaller, so maybe have dates do that too, instead of being all over the place like french people counting).

nicorac commented 10 months ago

days don't have 12 hours, they have 24 hours

I'm an Italian native, so I could agree; but it's not the same all over the world 😉

BCR-GUI does not have "fixed" date/time formats. It relies on culture-based well-known formats provided by JS Intl.DateTimeFormat() (see here for MDN documentation). The options you see in Settings page corresponds to "full", "long", "medium" and "short" formats. They all use the 12/24H format of current device culture, and there's actually no way to force it (except for setting another culture).

So that's strange you see 12H format if your device culture (as I suspect) is a 24H one...

Anyway, ISO format is a standard and culture-agnostic format, so I think it could be added easily.

m-sundman commented 10 months ago

days don't have 12 hours, they have 24 hours

I'm an Italian native, so I could agree; but it's not the same all over the world

Well, if you by "world" refer to this planet then the length of a day is exactly the same all over the world. (Even the international space station goes by earth time although they technically have 90 minute days.) :smile:

that's strange you see 12H format if your device culture (as I suspect) is a 24H one

What does "device culture" mean? In my device preferences I have chosen 24h time, and all other apps show 24h time. Maybe bcr-gui assumes your system language dictates your date and time formats, but that wouldn't be right. It should use the device date & time settings or/and provide user-configurable formats.

nicorac commented 10 months ago

It turned out that 12/24 hours Android setting is some kind of "override" over the default value Android gets from the selected culture. This override is not available in a webview not in a browser. Intl function cannot be aware of it 🙄.

That said, I've added a custom native plugin to read the override and "patch" the default time formats to comply with current 12/24 hours setting, being it retrived from the culture or forced.

Please note that the app reads the setting only at startup, so you need to kill the app and restart it to get settings changes.

Here you are a version to try (note, it's the same 0.0.18 version with the 12/24h patch...): bcr-gui-0.0.18-12-24-fix.zip

Please let me know if it works on your side

m-sundman commented 10 months ago

Here you are a version to try (note, it's the same 0.0.18 version with the 12/24h patch...): bcr-gui-0.0.18-12-24-fix.zip

Please let me know if it works on your side

Yay, this works great, for me at least! However, only the clock is detected, and I'm still missing an ISO date format, which is actually really annoying because I constantly read these silly wrong-ordered dates wrong, thinking every item this year was on the 23rd day of the month.

nicorac commented 10 months ago

ISO is a format that "covers" both date and time. Since BCR-GUI actually has two distinct settings for date and time, I need to find an easy/comprehensible way to set both together.

My first thought was to disable time format selector when date format is set to ISO...

m-sundman commented 10 months ago

You know, maybe you could just add support for a format string, and then people can do their %Y-%m-%d %H:%M:%S or whatever they want.

nicorac commented 10 months ago

You know, maybe you could just add support for a format string, and then people can do their %Y-%m-%d %H:%M:%S or whatever they want.

Just released v0.0.19 with this new feature 😉

m-sundman commented 10 months ago

You know, maybe you could just add support for a format string, and then people can do their %Y-%m-%d %H:%M:%S or whatever they want.

Just released v0.0.19 with this new feature 😉

Wow, it's working great! And really nice interface, with the preview and all!!!