woheller69 / weather

A privacy friendly weather app for Android with built in rain radar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

24-hour format not respected in rain radar view

xandro0777 opened this issue · comments

Despite 24h format enabled, the time is still displayed as am/pm.

that is a JavaScript part which simply uses .toLocaleString() for date time display.
I probably won't change that.
If someone knows a simple universal fix, let me know

I will try with .toLocaleString(navigator.language, { hour12: false })

Please try. Just remove .zip and install.

app-release.apk.zip

Not sure if webview is affected, Chrome needs { hourCycle: 'h23'} because of its 24 hours bug where it displays for example 24:15 instead of 0:15. So far it seems to work, hope I remember to look after midnight.

have you seen any problems after midnight?

Will try { hourCycle: 'h23'} instead of { hour12: false }

with hourCycle: 'h23'

please try again and let me know if it works

app-release.apk.zip

maybe webview dependent. Can you try this code:

const event = new Date(Date.UTC(2022, 01, 04, 23, 30, 0));
console.log(event.toLocaleString('en-GB', { hourCycle: 'h23'}));

e.g. paste and run here:
https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString
should show : > "05/02/2022, 00:30:00"

For me it works well. I made another change. The rain radar now shows the local time of the watched city.
app-release.apk.zip