Wrong Timezone, Still Back to the Default of -5

What happened:
Wrong time displayed when creating new ticket and when adding comment in a ticket. Even after Timezone changed to Asia/Jakarta, the time still is somehow hardcoded to use the default (America/New_York). Also, in Conversations, when a message is first sent, the timestamp is wrong, but it will display the correct time after refreshing the Conversations page.




Everything else shows the correct time including Dashboard.

What I have tried:

  1. Installation on native Linux Debian and using Docker, tried version 1.1.11, 1.2.0, 1.2.1, 1.2.2
  2. Tried fresh installation as well as upgraded version
  3. Change the timezone and restart the server. Also tried to use a private browsing session to access Trudesk after the restart of the server still producing the same (erroneous) result

Update:
After doing some more testing (on v1.2.2, then updated to v1.2.3), I found that the time display will show correct offset (UTC+7) after refreshing the browser by pressing the F5 (Refresh) key:

  1. After Create Ticket, open the ticket in the Tickets menu, refresh the browser
  2. After Create Ticket and add comments to the ticket, open the ticket in the ticket menu, refresh the browser
  3. After add comments to a ticket, refresh the browser

Then if I go to another ticket, other menu or logout, the time display will go back to UTC-5 offset.

Can you show me your system timezone, so I can troubleshoot accurately?

ie:
cat /etc/timezone

Hi Chris, thanks for your response. I attach the screenshot below:

timedatectl

3.js sets cookie to the default of America/New_York. Found a workaround, change the first entry of "America/New_York" to the local timezone in ~/trudesk/public/js/3.js, this works for me in linux debian:

sed -i 's/"America\/New_York"/"Asia\/Jakarta"/' /usr/src/trudesk/public/js/3.js

Afterwards, just refresh the web browser or open a new tab of Trudesk dashboard.

3.js sets cookie to the default of America/New_York. Found a workaround, change the first entry of "America/New_York" to the local timezone in ~/trudesk/public/js/3.js, this works for me in linux debian (Trudesk v1.2.3 and v1.2.4):

sed -i 's/"America\/New_York"/"Asia\/Jakarta"/' /usr/src/trudesk/public/js/3.js

Another example if your timezone is Asia/Phnom_Penh:

sed -i 's/"America\/New_York"/"Asia\/Phnom_Penh"/' /usr/src/trudesk/public/js/3.js

If Trudesk is running on docker container, do this first:

docker exec -it <container_name> bash

Then execute the sed command above. Afterwards, just refresh the web browser or open a new tab of Trudesk dashboard.

Update: The file is 4.js on Trudesk v1.2.5

I’m working on a perm fix for this issue and hope to have it ready for 1.2.6

On v.1.2.5 /trudesk/src/public/js/modules/helpers.js

helpers.setTimezone = function () {
const $timezone = $(‘#__timezone’)
let timezone
if ($timezone.length < 1) {
Cookies.set(‘$trudesk:timezone’, ‘America/New_York’)
} else {
timezone = Cookies.get(‘$trudesk:timezone’)
const __timezone = $timezone.text()
if (!timezone) {
Cookies.set(‘$trudesk:timezone’, __timezone)
} else if (timezone !== __timezone) {
Cookies.set(‘$trudesk:timezone’, __timezone)
}
}
timezone = Cookies.get(‘$trudesk:timezone’)
moment.tz.setDefault(timezone)
$timezone.remove()
}

I comment out this line:

Cookies.set(‘$trudesk:timezone’, ‘America/New_York’)

And it seems to work without having to hardcode local timezone. Of course it will only work if I rebuild Trudesk after changing the code.

I’m going to move the timezone setting to user prefs. Once that is completed each user can set the timezone they wish. (default to server timezone setting)

If you’re willing to do some timezone testing.

I have pushed a new branch (tz-update) that moves timezone settings to the profile → preferences page . This will allow a server fallback timezone but users have the ability to set their own timezone.
It’s still unstable as I haven’t tested all-time displays yet…

Thanks @polonel, I did the test on several menu and submenu:

Time Display without set TZ in user preferences (default to Settings > General)

  • Dashboard = OK
  • Tickets View = OK
  • Ticket Detail = OK
  • Ticket Print = OK
  • Messages View = OK
  • Message Conversation = OK

Time Display after set TZ in user preferences different than TZ in Settings > General:

  • Dashboard = Still following Settings > General
  • Tickets View = OK
  • Ticket Detail = OK
  • Ticket Print = Still following Settings > General
  • Messages View = OK
  • Message Conversation = OK

Thanks for this information. I’ll get these converted over to use the new user preferences.

I checked out 5a4de1f and rebuild Trudesk. As of now, time Display after set TZ in user preferences different than TZ in Settings > General:

  • Dashboard = OK
  • Tickets View = OK
  • Ticket Detail = OK
  • Ticket Print = OK
  • Messages View = OK
  • Message Conversation = OK

In the course of my setup, of course, I also came across it.

The whole system is now running on the correct time zone and with the correct time format (24h), but unfortunately not for answers. As described above, it somehow runs hardcoded on a different time zone…

I could also find no user-specific settings for this. Is there any news or things I need to be aware of?

Timezone Linux settings:
image

Timezone trudesk settings:
image

Ticket recorded time:

@Luukullus I just want to confirm you are on the master branch and not using the new ts branch where the timezone setting was moved to the user preferences.

This will be included in v1.2.6 which I believe fixes the issue.

Thank you for your reply.

Iam using the installed version 1.2.5 wich got delivered with the install script from Git.
Isn’t that correct?
I’ve noticed other problems, but maybe it’s all fixed with the version…

Yes, v1.2.5 is the latest release. There have been some timezone changes but it isn’t released yet. Will be included in v1.2.6 when it releases.

The changes bring timezone settings to user preferences with a fallback to the server setting.