Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript Agent does not respect timezone #1355

Closed
elvetemedve opened this issue Mar 15, 2016 · 3 comments
Closed

Javascript Agent does not respect timezone #1355

elvetemedve opened this issue Mar 15, 2016 · 3 comments

Comments

@elvetemedve
Copy link
Contributor

When I set the "TIMEZONE" environment variable to a zone other than the one set on the host, GUI will reflect the changes, but when a Date object is created from a Javascript Agent, it will use the time zone of the host machine instead of the application.

Steps to reproduce the issue:

  1. Set up a docker container following this guide https://github.com/cantino/huginn/blob/master/docker/multi-process/README.md and set the TIMEZONE=Budapest environment variable too.

  2. Start the application

  3. Create a new Javascript Agent, give it a name like test, and put the following lines to the code field:

    Agent.check = function() {
        var date = new Date();
        this.createEvent({ 'time': date.getHours() + ':' + date.getMinutes()  });
    };
    Agent.receive = function() { 
    };
  4. Click on the Dry Run button twice.

You will get a time which is in UTC. The expected time should be in UTC+1 (Europe/Budapest zone).

A quick workaround is to run sudo dkpg-reconfigure tzdata inside the Docker container and restart it after that.

@dsander
Copy link
Collaborator

dsander commented Mar 15, 2016

Thanks for reporting the issue and pointing in the right direction @elvetemedve . It looks like setting the TZ environment variable has the same effect as configuring the timezone system wide. Would you mind testing the change I made in #1356?

@elvetemedve
Copy link
Contributor Author

@dsander I've tested your changes and I can confirm that it works well. Well done. 👍

@dsander
Copy link
Collaborator

dsander commented Mar 16, 2016

@elvetemedve Thanks for verifying the fix works!

@dsander dsander closed this as completed Mar 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants