Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

24 hours instead of AM / PM #246

Closed
berti34 opened this issue Apr 24, 2024 · 19 comments
Closed

24 hours instead of AM / PM #246

berti34 opened this issue Apr 24, 2024 · 19 comments
Labels
enhancement New feature or request

Comments

@berti34
Copy link

berti34 commented Apr 24, 2024

The WebUI shows date and time in 12 hours format:
2024-04-24 at 12:30:17 AM - ....
That is 0:30:17 in the morning. That confuses when in a hurry...

How can I switch to get the 24 hours format?

I'm using Backrest 0.17.2 on many different Linux and Windows systems as binary.

@berti34 berti34 added the enhancement New feature or request label Apr 24, 2024
@berti34
Copy link
Author

berti34 commented May 7, 2024

Hi again! Do you think you can add that switch to the settings e.g. in version 1.0.0 maybe?
Greetings
Berthold

@garethgeorge
Copy link
Owner

Hey, looks like the browser provides an internationalized date time formatting API https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat

I think using this in https://github.com/garethgeorge/backrest/blob/main/webui/src/lib/formatting.ts#L20-L36 should be the right approach.

@kinghat
Copy link

kinghat commented May 7, 2024

im not sure if this is related. if not i can open a separate issue. i have a new plan that has never run and the plan schedule set to the default: 0:0 time:

image

with the config of:

  "cron": "0 0 * * *",

but in the plans tree view it says its scheduled for 7:00:00 PM:

image

@garethgeorge
Copy link
Owner

Are you using docker? This tends to happen when the timezone in the container is incorrect.

@kinghat
Copy link

kinghat commented May 7, 2024

Are you using docker? This tends to happen when the timezone in the container is incorrect.

yep, that makes sense. i think the linuxserver containers use this in their compose but not sure if TZ is something special to them:

    environment:
      - TZ=US/East

and the forgejo container mounts these volumes in compose:

    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro

@garethgeorge
Copy link
Owner

Yep! For backrest I think just setting the TZ variable should be enough. It’s handled by the tzdata alpine package added to the docked image.

@garethgeorge
Copy link
Owner

89a49c1 updates the time formatting to use the locale.

@berti34
Copy link
Author

berti34 commented May 14, 2024

Are you using docker? This tends to happen when the timezone in the container is incorrect.

No, just the binary version on Arm64, AMD64 and Windows 10.

@garethgeorge
Copy link
Owner

Just released 1.0.0 which will try to use the locale from your browser, let me know if that's working for you.

@berti34
Copy link
Author

berti34 commented May 21, 2024

Hi again,

looks good! Thank you!

grafik
grafik

@modem
Copy link

modem commented May 21, 2024

For me still shows AM and PM:

image

I have TZ set on the environment variables

    environment:
      - TZ=Europe/Lisbon

Inside the container it looks good:
image

Is there any other change needed?

@berti34
Copy link
Author

berti34 commented May 21, 2024 via email

@modem
Copy link

modem commented May 21, 2024

I'm on docker.

@kinghat
Copy link

kinghat commented May 21, 2024

I'm on docker.

try clearing your browser cache.

@garethgeorge
Copy link
Owner

The setting is based on your browser's locale for time formatting.

@modem
Copy link

modem commented May 21, 2024

I see it now, but it does not make sense to me. I have my browser language set to US English but there's no place to define the regional settings. And in fact this is the only software I access in the browser where I see this behavior. If we define the TZ environment variable, Backrest should stick to that instead of the browser settings.

@libeanim
Copy link

I have a similar problem, the browser locale seems sometimes inconsistent.
My system is US English, but I selected Germany as region, meaning my system shows everything in 24h:
Screenshot 2024-05-22 at 08 34 14
Also my broswer has German and locale Germany as preferred language for websites:
Screenshot 2024-05-22 at 08 35 08

Yet on backrest its still AM and PM, it only works if I manually override the locale in the dev console. Then its in 24h.
See https://stackoverflow.com/a/69149258

I guess its a minor issue and I am not sure if this is a browser bug or with backrest.

@modem
Copy link

modem commented May 22, 2024

I use Firefox and I don't find any setting to define the region, only the language. But I prefer the language set to English than to my mother language.
If we define the Timezone environment variable backrest should stick to that.

@berti34
Copy link
Author

berti34 commented Jun 3, 2024

Fore me it works as expected, so I can close this ticket.
Thanks

@berti34 berti34 closed this as completed Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants