OttPeterR / addon-babybuddy

BabyBuddy, wrapped into a Home Assistant addon
35 stars 13 forks source link

Localisation settings not working #55

Closed synnack closed 1 year ago

synnack commented 1 year ago

There are no localisation settings for django, which are needed because by default in english django defaults to Yank-mode ;-)

In any case, setting LANGUAGE_CODE somewhere is required to get proper date and time formats for your location.

I have not found any impact of the 24h setting though, in either position I get AM/PM weirdness :)

cdubz commented 1 year ago

Do you mean en-GB? I’m not sure why but Django’s locale uses 12 hour time for it: https://github.com/django/django/blob/048d75aeb1e2b1c08b1b9ec359397f00aec1b57d/django/conf/locale/en_GB/formats.py#L6

I tried to address this back in 1.x at babybuddy/babybuddy/issues/333 but it ended up causing lots of other weird issues trying to fight Django’s defaults.

There may be an opportunity to revisit this now in 2.x but I haven’t had a chance to look yet. The issue to chime in on or watch for that is babybuddy/babybuddy/issues/679.

synnack commented 1 year ago

Yeah, sorry. I thought it was the environment not reaching babybuddy, but after tracing that path that seems to be not the case (as the environment is not even used anymore). Language can be set per user, so that part works correctly.

I think I'm having weird issues with chromium and the browser-native datetime-local being in en_US mode while in fact I am in en_GB mode.

synnack commented 1 year ago

Ah yeah, confirmed. The problem is a bug in chromium that just completely fucks up all time settings in English (UK) mode :-(.

Works correctly in firefox. I'll close this as this bug is not with your project.

cdubz commented 1 year ago

Glad ya figured it out at least 😃

This is pretty much exactly why I made the changes I did in 2.x — one less layer to mess up localization hah.