Error in Chrome browser and others

Hello.
I have an error when using Chrome Browser. It gives a datetime zone error and shows me only the menu, the rest is blank. The same thing happens to me with Edge and Brave browsers.
With Firefox Browser, I don’t have that error and it works perfectly.
Log:
Error:
PHP Fatal error: Uncaught Exception: DateTimeZone::__construct(): Unknown or bad timezone (America/Buenos_Aires) in /var/www/html/dolibarr/htdocs/core/lib/functions.lib.php:2819

My Settings:
mysql Ver 15.1 Distrib 10.11.4-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper

PHP 8.2.10-2ubuntu1 (cli) (built: Sep 5 2023 14:37:47) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.10, Copyright (c) Zend Technologies
with Zend OPcache v8.2.10-2ubuntu1, Copyright (c), by Zend Technologies

Ubuntu server:
timedatectl
Local time: dom 2024-01-07 17:00:38 -03
Universal time: dom 2024-01-07 20:00:38 UTC
RTC time: dom 2024-01-07 20:00:38
Time zone: America/Argentina/Buenos_Aires (-03, -0300)
System clock synchronized: yes
NTP service: n/a
RTC in local TZ: no

php.info:
date
date/time support enabled
timelib version 2022.09
“Olson” Timezone Database Version 0.system
Timezone Database internal
Default timezone America/Argentina/Buenos_Aires

Directive Local Value Master Value
date.default_latitude 31.7667 31.7667
date.default_longitude 35.2333 35.2333
date.sunrise_zenith 90.833333 90.833333
date.sunset_zenith 90.833333 90.833333
date.timezone America/Argentina/Buenos_Aires America/Argentina/Buenos_Aires

Test:
grep -r “Buenos_Aires” ./dolibarr
./dolibarr/htdocs/includes/jstz/jstz.js: ‘-180,0’: ‘America/Argentina/Buenos_Aires’,
./dolibarr/htdocs/includes/sabre/sabre/vobject/lib/timezonedata/windowszones.php: ‘Argentina Standard Time’ => ‘America/Buenos_Aires’,
./dolibarr/htdocs/includes/sabre/sabre/vobject/lib/timezonedata/php-bc.php: ‘America/Buenos_Aires’,
./dolibarr/htdocs/includes/sabre/sabre/vobject/lib/timezonedata/lotuszones.php: ‘Argentina’ => ‘America/Argentina/Buenos_Aires’,
./dolibarr/htdocs/includes/sabre/sabre/vobject/lib/timezonedata/exchangezones.php: ‘Buenos Aires’ => ‘America/Argentina/Buenos_Aires’,
./dolibarr/htdocs/includes/sabre/sabre/vobject/lib/TimezoneGuesser/GuessFromMsTzId.php: 32 => ‘America/Argentina/Buenos_Aires’,
./dolibarr/htdocs/includes/sabre/sabre/vobject/lib/TimeZoneUtil.php: 32 => ‘America/Argentina/Buenos_Aires’,

Versions:
18.0.4 and 19.0 beta

Thank you very much, sincerely Luis

I would suggest that you make a bug report as an issue on Dolibarrs Github

https://github.com/Dolibarr/dolibarr/issues?q=is%3Aissue+Buenos_Aires

I briefly looked at the files that you also grepped for. If you grep for ‘America/Buenos_Aires’ and for ‘America/Argentina/Buenos_Aires’ you’ll notice that there are more with Argentina in string than without.

If I look at https://www.php.net/manual/en/timezones.america.php I ONLY see with /Argentina/ in string

So Maybe it is safe to just do a search and replace? I do not live in Argentina so I don’t know which is the correct text. Maybe you yourself want to edit the files so they are correct? Just use the github editor and then create a pull request yourself.

There might be other timezones to fix in these 2 files, which I think are those that should be fixed

./htdocs/includes/sabre/sabre/vobject/lib/timezonedata/php-bc.php
./htdocs/includes/sabre/sabre/vobject/lib/timezonedata/windowszones.php

like ‘America/Catamarca’,?

1 Like

Thank you very much for answering.
I made the modifications of the two files to “America/Argentina/Buenos_Aires”, then I did a new installation. But I get the same error… Where does the value “America/Buenos_Aires” come from?
Add a new issue.

Did you make the changes locally or did you edit them on github and made a merge reuest?

Are your changes still in the new installation?

I made the changes locally in those 2 files before installing. But the same error continues. On github just add the issue

Are the changes still there after the install or was they overwritten?

Yes, they are still there, they were not overwritten

Okay. Are there any errors in your browsers console? (you might need to go into developer tools in your browser).

What does the Dolibarr hosting log say? what does your webserver log say?

Chrome:
chrome-error

Nginx error:

dolibarr/htdocs/includes/sabre/sabre/vobject/lib/timezonedata/php-bc.php (modified before installing)
php-bc

dolibarr/htdocs/includes/sabre/sabre/vobject/lib/timezonedata/windowszones.php (modified before installing)
windowszones

nginx says that it is still looking for America/Buenos_Aires, so I’d like you to check these 3 things and do a 4th things.

Check:

  1. which timezone does the underlying server run?
  2. are nginx configured to be in America/Buenos_Aires?
  3. Do your browser request the timezone as America/Buenos_Aires? It might be since some works and others does not work.

Todo:
4. Post these pictures on your Github Issue

High above you post an error with a line number. Which version of dolibarr is that error from? (trying to get the correcter line number).

I would also like if you could cd to the htdocs dir where ever you have that, and then I’d like you to run this command:

grep -irl America/Buenos_Aires *

I expect NO output, but if there are some output, please list those files here, and then edit the files to be America/Argentina/Buenos_Aires

I think I found the error: It’s the browser. I don’t know why it has that wrong value for Buenos_Aires. I installed a plugin where I can change the time zone in Chrome (natively you can’t). I change the time zone as you can see:
Zona1

But when checking (Chrome, Brave, Edge, Chromium)

The zone is bad.

Mozila Firefox:


The zone is good

The question is. Is it possible for Dolibarr to take the timezone of the web server (nginx, php) Not the browser?
Thank you very much
Luis

Good you found it. If you haven’t already posted this in Github I think you should