How to set user timezone

does Jmix still support the functionality to allow user to change TimeZone from Help-> Setting menu (similar to the one we have on CUBA platform)?

If yes, then how do I enable it? I couldn’t find any related documentation on Jmix website.

Hi,

TimeZone for a user is autodetected by the web browser. Unfortunately, now there is no possibility to set up a timezone directly on the user. Maybe we will do it later.

@subbotin, thanks for your answer.

In case I would like to develop the timezone selection myself. I believe the UI part would be easy by using the combobox component.

But from the server side, how do I set the timezone to a particular user session so that it will be used to convert all timestamp value to show up on the UI. I couldn’t find any Jmix document mentioned this.

Any idea would be much appreciated.

You can do it in the login screen. Open LoginScreen.java in your project, find the login() method and add .withTimeZone() to the created AuthDetails object:

loginScreenSupport.authenticate(
        AuthDetails.of(username, password)
                .withLocale(localesField.getValue())
                .withRememberMe(rememberMeCheckBox.isChecked())
                .withTimeZone(TimeZone.getTimeZone("Europe/Moscow")),
        this);
1 Like

Hi,
We have created an issue to support the timezone settings on a User entity.

1 Like

thanks @krivopustov. I couldn’t find it earlier because I’m using Jmix version 0.9.1 released from May.

I guess I have to upgrade to 1.0.0 to see that withTimeZone() method

@subbotin, thanks for the update. I’ll be waiting for that and in the meantime exploring the work-around I mentioned above.