sitespeed.io icon indicating copy to clipboard operation
sitespeed.io copied to clipboard

How to set the locale/timezone?

Open yuis-ice opened this issue 1 year ago • 8 comments

Your question

Hi. The docker result/export html date shows different time from my time (Japan), and from the computer also. How to set the locale, time, date, timezone?

yuis-ice avatar Aug 28 '24 06:08 yuis-ice

Hi @yuis-ice do you use the Docker container? If you add -v /etc/localtime:/etc/localtime:ro the container will use the same time as the server where it runs. Do that work for you?

soulgalore avatar Aug 28 '24 06:08 soulgalore

Hi, I tried it but looks not working.

$ date 
Wed 28 Aug 2024 07:24:51 PM JST
$ 
$ docker run --rm -v "$(pwd)":/sitespeed.io -v /etc/localtime:/etc/localtime:ro sitespeedio/sitespeed.io https://mysite.com
Google Chrome 127.0.6533.72 
Mozilla Firefox 128.0
Microsoft Edge 126.0.2592.113 
[2024-08-28 10:24:56] INFO: Versions OS: linux 5.15.0-105-generic nodejs: v20.15.1 sitespeed.io: 34.9.0 browsertime: 22.8.0 coach: 8.0.2
[2024-08-28 10:24:56] INFO: Running tests using Chrome - 3 iteration(s)
[2024-08-28 10:24:57] INFO: Testing url https://mysite.com iteration 1

Thanks for your help.

yuis-ice avatar Aug 28 '24 10:08 yuis-ice

Hi @yuis-ice what OS are you using when you run the containers?

soulgalore avatar Aug 28 '24 12:08 soulgalore

Hi, it's Ubuntu 20.04.4

yuis-ice avatar Aug 28 '24 13:08 yuis-ice

Looking at https://stackoverflow.com/questions/24551592/how-to-make-sure-dockers-time-syncs-with-that-of-the-host it seems people uses -v /etc/timezone:/etc/timezone:ro v- /etc/localtime:/etc/localtime:ro can you try and see if that helps?

soulgalore avatar Aug 28 '24 16:08 soulgalore

您的问题

你好。docker result/export html date 显示的时间与我的时间(日本)不同,也与计算机显示的时间不同。如何设置区域设置、时间、日期、时区?

What about adding the -e TZ=“Asia/Tokyo” parameter to the docker?

fangyuan2357 avatar Aug 30 '24 11:08 fangyuan2357

It still doesn't work with -e TZ=“Asia/Tokyo”

$ docker run --rm -v "$(pwd)":/sitespeed.io -e TZ=“Asia/Tokyo” sitespeedio/sitespeed.io https://mysite.com
Google Chrome 127.0.6533.72 
Mozilla Firefox 128.0
Microsoft Edge 126.0.2592.113 
[2024-09-02 16:50:55] INFO: Versions OS: linux 5.15.0-105-generic nodejs: v20.15.1 sitespeed.io: 34.9.0 browsertime: 22.8.0 coach: 8.0.2
[2024-09-02 16:50:55] INFO: Running tests using Chrome - 3 iteration(s)

$ date
Tue 03 Sep 2024 01:52:16 AM JST

yuis-ice avatar Sep 02 '24 16:09 yuis-ice

Hmm strange, adding TZ works for me (my base OS is a Mac):

date
Mon Sep  2 22:24:53 CEST 2024

~/git/sitespeed.io main*
❯ docker run --rm -v "$(pwd):/sitespeed.io"  -e TZ="Asia/Tokyo" sitespeedio/sitespeed.io:34.11.0 https://www.sitespeed.io/ -n 1

Google Chrome 128.0.6613.84 
Mozilla Firefox 129.0
Microsoft Edge 127.0.2651.105 
[2024-09-03 05:25:04] INFO: Versions OS: linux 6.10.0-linuxkit nodejs: v20.17.0 sitespeed.io: 34.11.0 browsertime: 22.9.0 coach: 8.0.2
[2024-09-03 05:25:04] INFO: Running tests using Chrome - 1 iteration(s)
[2024-09-03 05:25:05] INFO: Testing url https://www.sitespeed.io/ iteration 1

soulgalore avatar Sep 02 '24 20:09 soulgalore

Works for me so closing.

soulgalore avatar May 17 '25 12:05 soulgalore