v2 icon indicating copy to clipboard operation
v2 copied to clipboard

Unable to set default timezone for new user

Open szpak opened this issue 2 years ago • 2 comments

I've set up Miniflux 2.0.35 with Podman (an alternative to Docker) and it works nicely. It initialized with UTC as a time zone and I wanted to change it. I set a time zone for a container to "Europe/Warsaw" (and recreated it), set the TZ environment variable (and recreated it), but for a new user the time zone is always set to UTC.

I saw that a time zone is set for an user in a database and I can change it after creation, but I wonder, if Miniflux takes a system time zone into account when it starts up (or rather the global value is persistent in a database after the initial execution and should be changed there)?

szpak avatar Feb 17 '22 21:02 szpak

I saw that a time zone is set for an user in a database and I can change it after creation, but I wonder, if Miniflux takes a system time zone into account when it starts up (or rather the global value is persistent in a database after the initial execution and should be changed there)?

Miniflux uses the default value specified in the schema.

miniflux2=# \d users
                                            Table "public.users"
       Column       |           Type           | Collation | Nullable |               Default
--------------------+--------------------------+-----------+----------+-------------------------------------
 id                 | integer                  |           | not null | nextval('users_id_seq'::regclass)
 username           | text                     |           | not null |
 password           | text                     |           |          |
 is_admin           | boolean                  |           |          | false
 language           | text                     |           |          | 'en_US'::text
 timezone           | text                     |           |          | 'UTC'::text
....

fguillot avatar Feb 18 '22 04:02 fguillot

Thanks @fguillot . It shows how to change it in my case.

As I see UTC is hardcoded in the initial migration: https://github.com/miniflux/v2/blob/4b6e46d9abc2d0521809ade80af1e4bbba6b9260/database/migrations.go#L27

I wonder, if you think it might make sense to take that value from the system time zone during the initial migration or maybe - to prevent confusion - to have a dedicated (optional) environment to achieve that?

szpak avatar Feb 18 '22 08:02 szpak