sitespeedio / sitespeed.io

sitespeed.io is an open-source tool for comprehensive web performance analysis, enabling you to test, monitor, and optimize your website’s speed using real browsers in various environments.
https://www.sitespeed.io/
MIT License
4.75k stars 602 forks source link

How to set the locale/timezone? #4263

Open yuis-ice opened 2 months ago

yuis-ice commented 2 months ago

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?

soulgalore commented 2 months ago

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?

yuis-ice commented 2 months ago

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.

soulgalore commented 2 months ago

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

yuis-ice commented 2 months ago

Hi, it's Ubuntu 20.04.4

soulgalore commented 2 months ago

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?

taozhu520222 commented 2 months ago

您的问题

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

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

yuis-ice commented 2 months ago

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
soulgalore commented 2 months ago

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