Huginn: Per User TimeZone settings

Created on 2 Jun 2014  Â·  9Comments  Â·  Source: huginn/huginn

It would be good to be able to setup timezone preferences on a user/account level rather than Huginn-wide (though obviously that can still control the default)

Running a 6pm on a server configured for a different timezone becomes a bit of a mindbend.

enhancement help wanted

Most helpful comment

Rather than per user, why not storing everything in UTC and using the browser client time zone to set the times to the user?

All 9 comments

Good idea.

We'll need it to get set anywhere we're doing code. For the Rails portions, an around_filter in the application controller should probably work:

class ApplicationController < ActionController::Base
  around_filter :set_time_zone

  def set_time_zone
    if logged_in?
      Time.use_zone(current_user.time_zone) { yield }
    else
      yield
    end
  end
end

Other portions (like scheduler) will need to handle this themselves.

  • I'm guessing user.time_zone doesn't currently exist either? So would need a migration for that.
  • Also a view update to change timezone on the account page (/users/edit) (is there an easy way to list all possible timezones in a dropdown?)
  • The updates to scheduler/etc

Anything else?

@alias1 yep there is the time_zone_select helper.
We probably could change the TZ of the scheduler to UTC and convert users timezone to UTC in the controller right?

That could be a good idea. I was actually thinking along the lines of maybe UTC should be default or whatnot.

But you currently set the instance default in config yeah? Would that change to just setting the default for new users?
—
Sent from Mailbox

On Wed, Jun 4, 2014 at 3:06 AM, Dominik Sander [email protected]
wrote:

@alias1 yep there is the time_zone_select helper.

We probably could change the TZ of the scheduler to UTC and convert users timezone to UTC in the controller right?

Reply to this email directly or view it on GitHub:
https://github.com/cantino/huginn/issues/362#issuecomment-44992388

Yeah, actually I do not know the details about this part of huginn yet, but you might be right, the migration could be hard/impossible without manual changes.

Migrations should have access to env variables I would think? If so, then read the .env TZ, use that to set all of the users TZ (which they can later change from account settings), and then use the .env TZ as the default for any new users (or, move that setting to an admin panel, see below)

Only a similar strain of thought, I wonder if we can/should look at moving some of the things currently configured by .env into an 'admin panel' configuration inside Huginn itself (obviously only things that aren't required to run Huginn itself; the invite code comes to mind, that is only used to set the DB during install isn't it?)

Migrating some things into Huginn makes sense. Right now we don't have an "admin interface" for admin users. Everyone is just a user. For now, your idea of pulling in the timezone on migration, then allowing editing in a user's settings page makes sense to me.

Rather than per user, why not storing everything in UTC and using the browser client time zone to set the times to the user?

I set up docker image and got timezone problem, so this would have been nice feature to have.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

scumola picture scumola  Â·  4Comments

IAMEVANHE picture IAMEVANHE  Â·  3Comments

TOrfevres picture TOrfevres  Â·  3Comments

vijayrajah picture vijayrajah  Â·  5Comments

GlassedSilver picture GlassedSilver  Â·  8Comments